Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework adapter tests namespaces to be consistent #586

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions phpbench.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"$schema": "./tools/phpbench/vendor/phpbench/phpbench/phpbench.schema.json",
"runner.bootstrap": "vendor/autoload.php",
"runner.path": [
"src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Benchmark/",
"src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Benchmark/",
"src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/",
"src/adapter/etl-adapter-json/tests/Flow/ETL/Tests/Benchmark/",
"src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Benchmark/",
"src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Benchmark/",
"src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Benchmark/",
"src/adapter/etl-adapter-xml/tests/Flow/ETL/Tests/Benchmark/",
"src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Benchmark/",
"src/core/etl/tests/Flow/ETL/Tests/Benchmark/"
],
"runner.progress": "dots",
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
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Flow\ETL\Adapter\Text\Tests\Benchmark;
namespace Flow\ETL\Adapter\Avro\Tests\Benchmark;

use Flow\ETL\DSL\Avro;
use PhpBench\Attributes\Iterations;
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
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Flow\ETL\Adapter\Text\Tests\Benchmark;
namespace Flow\ETL\Adapter\CSV\Tests\Benchmark;

use Flow\ETL\DSL\CSV;
use PhpBench\Attributes\Iterations;
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
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

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

use Flow\ETL\DSL\Json;
use PhpBench\Attributes\Iterations;
Expand All @@ -12,6 +12,6 @@ final class JsonExtractorBench
#[Revs(1000)]
public function bench_extract() : void
{
Json::from(__DIR__ . '/../../../../Fixtures/timezones.json');
Json::from(__DIR__ . '/../Fixtures/timezones.json');
}
}
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
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Flow\ETL\Adapter\Text\Tests\Benchmark;
namespace Flow\ETL\Adapter\Parquet\Tests\Benchmark;

use Flow\ETL\DSL\Parquet;
use PhpBench\Attributes\Iterations;
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
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Flow\ETL\Adapter\Text\Tests\Benchmark;
namespace Flow\ETL\Adapter\XML\Tests\Benchmark;

use Flow\ETL\DSL\XML;
use PhpBench\Attributes\Iterations;
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__ . '/../../../Fixtures/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__ . '/../../../Fixtures/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__ . '/../../../Fixtures/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__ . '/../../../Fixtures/simple_items.xml', 'root/items'))
->read(XML::from(__DIR__ . '/../Fixtures/simple_items.xml', 'root/items'))
->fetch()
);
}
Expand Down
Loading