Skip to content

Commit

Permalink
Rework adapter tests namespaces to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Oct 15, 2023
1 parent 37d509d commit 1bf1c03
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 43 deletions.
3 changes: 2 additions & 1 deletion infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"directories": [
"src/core/etl/src",
"src/adapter/etl-adapter-avro/src",
"src/adapter/etl-adapter-csv/src",
"src/adapter/etl-adapter-chartjs/src",
"src/adapter/etl-adapter-csv/src",
"src/adapter/etl-adapter-doctrine/src",
"src/adapter/etl-adapter-elasticsearch/src",
"src/adapter/etl-adapter-google-sheet/src",
"src/adapter/etl-adapter-http/src",
"src/adapter/etl-adapter-json/src",
"src/adapter/etl-adapter-logger/src",
"src/adapter/etl-adapter-meilisearch/src",
"src/adapter/etl-adapter-parquet/src",
"src/adapter/etl-adapter-text/src",
"src/adapter/etl-adapter-xml/src",
Expand Down
35 changes: 18 additions & 17 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
cacheResultFile="./var/phpunit/phpunit.cache"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerErrors="true"
executionOrder="random"
>
<coverage cacheDirectory="./var/phpunit/">
<report>
Expand All @@ -25,40 +26,40 @@
</php>
<testsuites>
<testsuite name="unit">
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Adapter/AMPHP/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Adapter/ReactPHP/Tests/Unit</directory>
<directory>src/core/etl/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit</directory>
<directory>src/lib/dremel/tests/Flow/Dremel/Tests/Unit</directory>
<directory>src/lib/parquet/tests/Flow/Parquet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-logger/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Unit</directory>
</testsuite>
<testsuite name="integration-io">
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Adapter/AMPHP/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-json/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Adapter/ReactPHP/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-xml/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration</directory>
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/lib/parquet/tests/Flow/Parquet/Tests/Integration</directory>
</testsuite>
<testsuite name="integration-services">
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration</directory>
</testsuite>
</testsuites>
<source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Async\Tests\Integration\Server;
namespace Flow\ETL\Adapter\AMPHP\Tests\Integration\Server;

use const Amp\Process\IS_WINDOWS;
use function Amp\async;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Async\Tests\Unit\Server;
namespace Flow\ETL\Adapter\AMPHP\Tests\Unit\Server;

use Flow\ETL\Async\Amp\Server\SocketServer;
use Flow\ETL\Async\Socket\Server\ServerProtocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Adapter\Avro\FlixTech\Tests\Integration;
namespace Flow\ETL\Adapter\Avro\Tests\Integration;

use Flow\ETL\Config;
use Flow\ETL\DSL\Avro;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Adapter\Avro\FlixTech\Tests\Unit;
namespace Flow\ETL\Adapter\Avro\Tests\Unit;

use Flow\ETL\Adapter\Avro\FlixTech\ValueConverter;
use Flow\ETL\Exception\InvalidArgumentException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Integration;
namespace Flow\ETL\Adapter\HTTP\Tests\Integration;

use Flow\ETL\Adapter\Http\DynamicExtractor\NextRequestFactory;
use Flow\ETL\Adapter\Http\PsrHttpClientDynamicExtractor;
use Flow\ETL\Config;
use Flow\ETL\FlowContext;
use Http\Mock\Client;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand All @@ -19,12 +20,12 @@ final class PsrHttpClientDynamicExtractorTest extends TestCase
public function test_http_extractor() : void
{
$psr17Factory = new Psr17Factory();
$psr18Client = new \Http\Mock\Client($psr17Factory);
$psr18Client = new Client($psr17Factory);

$psr18Client->addResponse(
new Response(200, [
'Server' => 'GitHub.com',
], \file_get_contents(__DIR__ . '/../json/flow-php.json')),
], \file_get_contents(__DIR__ . '/../Fixtures/flow-php.json')),
);

$extractor = new PsrHttpClientDynamicExtractor($psr18Client, new class implements NextRequestFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Integration;
namespace Flow\ETL\Adapter\HTTP\Tests\Integration;

use Flow\ETL\Adapter\Http\PsrHttpClientStaticExtractor;
use Flow\ETL\Config;
Expand All @@ -21,10 +21,10 @@ public function test_http_extractor() : void
$psr17Factory = new Psr17Factory();
$psr18Client = new Client($psr17Factory);
$psr18Client->addResponse(
new Response(200, [], \file_get_contents(__DIR__ . '/../json/norberttech.json')),
new Response(200, [], \file_get_contents(__DIR__ . '/../Fixtures/norberttech.json')),
);
$psr18Client->addResponse(
new Response(200, [], \file_get_contents(__DIR__ . '/../json/tomaszhanc.json')),
new Response(200, [], \file_get_contents(__DIR__ . '/../Fixtures/tomaszhanc.json')),
);

$requests = static function () use ($psr17Factory) : \Generator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Unit;
namespace Flow\ETL\Adapter\HTTP\Tests\Unit;

use Flow\ETL\Adapter\Http\RequestEntriesFactory;
use Flow\ETL\Row\Entry\JsonEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Integration\Adapter\JSON\JSONMachine;
namespace Flow\ETL\Adapter\JSON\Tests\Integration\JSONMachine;

use Flow\ETL\Adapter\JSON\JSONMachine\JsonExtractor;
use Flow\ETL\Config;
Expand All @@ -19,7 +19,7 @@ final class JsonExtractorTest extends TestCase
public function test_extracting_json_from_local_file_stream() : void
{
$rows = (new Flow(Config::builder()->putInputIntoRows()))
->read(Json::from(__DIR__ . '/../Fixtures/timezones.json', 5))
->read(Json::from(__DIR__ . '/../../Fixtures/timezones.json', 5))
->fetch();

foreach ($rows as $row) {
Expand All @@ -42,7 +42,7 @@ public function test_extracting_json_from_local_file_stream() : void
public function test_extracting_json_from_local_file_stream_using_pointer() : void
{
$rows = (new Flow())
->read(Json::from(__DIR__ . '/../Fixtures/nested_timezones.json', 5, pointer: '/timezones'))
->read(Json::from(__DIR__ . '/../../Fixtures/nested_timezones.json', 5, pointer: '/timezones'))
->fetch();

foreach ($rows as $row) {
Expand All @@ -64,7 +64,7 @@ public function test_extracting_json_from_local_file_stream_using_pointer() : vo

public function test_extracting_json_from_local_file_string_uri() : void
{
$extractor = new JsonExtractor(Path::realpath(__DIR__ . '/../Fixtures/timezones.json'), 5);
$extractor = new JsonExtractor(Path::realpath(__DIR__ . '/../../Fixtures/timezones.json'), 5);

$total = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Integration\Adapter\JSON;
namespace Flow\ETL\Adapter\JSON\Tests\Integration;

use Flow\ETL\Adapter\JSON\JsonLoader;
use Flow\ETL\Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Unit\Adapter\Logger\Logger;
namespace Flow\ETL\Adapter\Logger\Tests\Unit\Logger;

use Flow\ETL\Adapter\Logger\Logger\DumpLogger;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Unit\Adapter\Logger;
namespace Flow\ETL\Adapter\Logger\Tests\Unit;

use Flow\ETL\Adapter\Logger\PsrLoggerLoader;
use Flow\ETL\Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Async\Tests\Integration\ReactPHP\Server;
namespace Flow\ETL\Adapter\ReactPHP\Tests\Integration\Server;

use function Flow\ETL\DSL\lit;
use Flow\ETL\Async\ReactPHP\Server\SocketServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Async\Tests\Unit\ReactPHP\Server;
namespace Flow\ETL\Adapter\ReactPHP\Tests\Unit\Server;

use Flow\ETL\Async\ReactPHP\Server\SocketServer;
use Flow\ETL\Exception\InvalidArgumentException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Flow\ETL\Tests\Integration\Adapter\XML;
namespace Flow\ETL\Adapter\XML\Tests\Integration;

use Flow\ETL\DSL\Entry;
use Flow\ETL\DSL\XML;
Expand All @@ -16,12 +16,12 @@ final class XMLReaderExtractorTest extends TestCase
public function test_reading_xml() : void
{
$xml = new \DOMDocument();
$xml->load(__DIR__ . '/xml/simple_items.xml');
$xml->load(__DIR__ . '/../Fixtures/simple_items.xml');

$this->assertEquals(
(new Rows(Row::create(Entry::xml('node', $xml)))),
(new Flow())
->read(XML::from(__DIR__ . '/xml/simple_items.xml'))
->read(XML::from(__DIR__ . '/../Fixtures/simple_items.xml'))
->fetch()
);
}
Expand All @@ -37,7 +37,7 @@ public function test_reading_xml_each_collection_item() : void
Row::create(Entry::xml('node', '<item item_attribute_01="5"><id id_attribute_01="5">5</id></item>')),
),
(new Flow())
->read(XML::from(__DIR__ . '/xml/simple_items_flat.xml', 'root/items/item'))
->read(XML::from(__DIR__ . '/../Fixtures/simple_items_flat.xml', 'root/items/item'))
->fetch()
);
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public function test_reading_xml_from_path() : void
$this->assertEquals(
new Rows(Row::create(Entry::xml('node', $xml))),
(new Flow())
->read(XML::from(__DIR__ . '/xml/simple_items.xml', 'root/items'))
->read(XML::from(__DIR__ . '/../Fixtures/simple_items.xml', 'root/items'))
->fetch()
);
}
Expand Down

0 comments on commit 1bf1c03

Please sign in to comment.