From 88eaac8742e9297339eeea70d381c4473acf1a60 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Sat, 25 May 2024 18:51:08 +0200 Subject: [PATCH] Prepare for PHPUnit 11 --- .../GoogleSheet/Tests/Unit/ColumnsTest.php | 5 ++--- .../GoogleSheet/Tests/Unit/SheetRangeTest.php | 9 +++----- .../Tests/Unit/RequestEntriesFactoryTest.php | 5 ++--- .../Tests/Unit/ArrayComparisonTest.php | 9 +++----- .../Tests/Unit/ArraySortByKeyTest.php | 5 ++--- .../Integration/Filesystem/RealpathTest.php | 5 ++--- .../Tests/Integration/Function/HashTest.php | 5 ++--- .../Unit/Formatter/ASCII/ASCIIValueTest.php | 9 +++----- .../Flow/ETL/Tests/Unit/Function/CastTest.php | 5 ++--- .../Flow/ETL/Tests/Unit/PartitionTest.php | 9 +++----- .../Tests/Unit/Row/Entry/ArrayEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/BooleanEntryTest.php | 5 ++--- .../Unit/Row/Entry/DateTimeEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/FloatEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/IntegerEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/JsonEntryTest.php | 5 ++--- .../Unit/Row/Entry/JsonObjectEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/ObjectEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/StringEntryTest.php | 5 ++--- .../Unit/Row/Entry/StructureEntryTest.php | 5 ++--- .../Tests/Unit/Row/Entry/UuidEntryTest.php | 9 +++----- .../ETL/Tests/Unit/Row/Entry/XMLEntryTest.php | 5 ++--- .../etl/tests/Flow/ETL/Tests/Unit/RowTest.php | 5 ++--- .../tests/Flow/ETL/Tests/Unit/RowsTest.php | 13 ++++-------- .../Flow/ETL/Tests/Unit/Stream/PathTest.php | 21 ++++++------------- .../Bulk/Tests/Unit/DbalPlatformTest.php | 5 ++--- .../Binary/BinaryReaderWriterTest.php | 5 ++--- .../Flow/RDSL/Tests/Unit/NamespaceTest.php | 9 +++----- 28 files changed, 68 insertions(+), 120 deletions(-) diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php index 39d054704..deb885bbe 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/ColumnsTest.php @@ -6,6 +6,7 @@ use Flow\ETL\Adapter\GoogleSheet\Columns; use Flow\ETL\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ColumnsTest extends TestCase @@ -46,9 +47,7 @@ public static function invalid_cases() : \Generator ]; } - /** - * @dataProvider invalid_cases - */ + #[DataProvider('invalid_cases')] public function test_assertions(string $sheetName, string $startColumn, string $endColumn, string $expectedExceptionMessage) : void { $this->expectException(InvalidArgumentException::class); diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/SheetRangeTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/SheetRangeTest.php index a12e9a924..eb0a3207b 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/SheetRangeTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/SheetRangeTest.php @@ -6,6 +6,7 @@ use Flow\ETL\Adapter\GoogleSheet\{Columns, SheetRange}; use Flow\ETL\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class SheetRangeTest extends TestCase @@ -46,9 +47,7 @@ public static function invalid_cases() : \Generator ]; } - /** - * @dataProvider invalid_cases - */ + #[DataProvider('invalid_cases')] public function test_assertions(int $startRow, int $endRow, string $expectedExceptionMessage) : void { $this->expectExceptionMessage($expectedExceptionMessage); @@ -64,9 +63,7 @@ public function test_next_rows_range() : void self::assertSame('Sheet2!A21:B40', $range->nextRows(10)->nextRows(20)->toString()); } - /** - * @dataProvider example_string_ranges - */ + #[DataProvider('example_string_ranges')] public function test_range_to_string(SheetRange $range, string $expectedStringRange) : void { self::assertSame($expectedStringRange, $range->toString()); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Unit/RequestEntriesFactoryTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Unit/RequestEntriesFactoryTest.php index 5aba7f8c3..074c2a89c 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Unit/RequestEntriesFactoryTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Unit/RequestEntriesFactoryTest.php @@ -7,6 +7,7 @@ use Flow\ETL\Adapter\Http\RequestEntriesFactory; use Flow\ETL\Row\Entry\{JsonEntry, StringEntry}; use Nyholm\Psr7\Factory\Psr17Factory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; @@ -44,9 +45,7 @@ public static function requests() : \Generator ]; } - /** - * @dataProvider requests - */ + #[DataProvider('requests')] public function test_uses_expected_entry_for_request_body(string $expectedRequestBodyEntryClass, RequestInterface $request) : void { $entryFactory = new RequestEntriesFactory(); diff --git a/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArrayComparisonTest.php b/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArrayComparisonTest.php index e28667211..9cb6f5e39 100644 --- a/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArrayComparisonTest.php +++ b/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArrayComparisonTest.php @@ -5,6 +5,7 @@ namespace Flow\ArrayComparison\Tests\Unit; use Flow\ArrayComparison\ArrayComparison; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ArrayComparisonTest extends TestCase @@ -143,17 +144,13 @@ public function test_compare_arrays() : void ); } - /** - * @dataProvider equal_arrays - */ + #[DataProvider('equal_arrays')] public function test_equals(array $a, array $b) : void { self::assertTrue((new ArrayComparison())->equals($a, $b)); } - /** - * @dataProvider not_equal_arrays - */ + #[DataProvider('not_equal_arrays')] public function test_not_equals(array $a, array $b) : void { self::assertFalse((new ArrayComparison())->equals($a, $b)); diff --git a/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArraySortByKeyTest.php b/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArraySortByKeyTest.php index 68474303a..97292e013 100644 --- a/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArraySortByKeyTest.php +++ b/src/core/etl/tests/Flow/ArrayComparison/Tests/Unit/ArraySortByKeyTest.php @@ -5,6 +5,7 @@ namespace Flow\ArrayComparison\Tests\Unit; use Flow\ArrayComparison\ArraySortByKey; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ArraySortByKeyTest extends TestCase @@ -109,9 +110,7 @@ public function arrays() : \Generator ]; } - /** - * @dataProvider arrays - */ + #[DataProvider('arrays')] public function test_sorts_array_by_key(array $origin, array $sorted) : void { // serialize to JSON to be sure that array is sorted exactly as expected diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/RealpathTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/RealpathTest.php index dd673cbb3..edfca9943 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/RealpathTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/RealpathTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Integration\Filesystem; use Flow\ETL\Filesystem\Path; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class RealpathTest extends TestCase @@ -17,9 +18,7 @@ public static function double_dots_paths() : \Generator yield ['/path/more/nested/..//../file.txt', '/path/file.txt']; } - /** - * @dataProvider double_dots_paths - */ + #[DataProvider('double_dots_paths')] public function test_double_dots_in_path(string $relative, string $absolute) : void { self::assertEquals(new Path($absolute), Path::realpath($relative)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Function/HashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Function/HashTest.php index 5b3dc495f..b0c0c3904 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Function/HashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Function/HashTest.php @@ -7,6 +7,7 @@ use function Flow\ETL\DSL\{from_array, ref, to_memory}; use Flow\ETL\Flow; use Flow\ETL\Memory\ArrayMemory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class HashTest extends TestCase @@ -18,9 +19,7 @@ public static function provideValues() : \Generator yield 'string' => ['value', 'd7ab8cce59abd5050d59506fb013961a']; } - /** - * @dataProvider provideValues - */ + #[DataProvider('provideValues')] public function test_hash_on_given_value(mixed $value, string $expected) : void { (new Flow()) diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Formatter/ASCII/ASCIIValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Formatter/ASCII/ASCIIValueTest.php index 1e61cd60b..241b40678 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Formatter/ASCII/ASCIIValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Formatter/ASCII/ASCIIValueTest.php @@ -6,6 +6,7 @@ use function Flow\ETL\DSL\datetime_entry; use Flow\ETL\Formatter\ASCII\ASCIIValue; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ASCIIValueTest extends TestCase @@ -29,9 +30,7 @@ public static function values_without_truncating() : \Generator yield [['a' => 1, 'b' => 2, 'c' => ['test']], '{"a":1,"b":2,"c":["test"]}']; } - /** - * @dataProvider values_without_truncating - */ + #[DataProvider('values_without_truncating')] public function test_converting_value_to_ascii_value(mixed $value, string $asciiValue) : void { self::assertSame( @@ -40,9 +39,7 @@ public function test_converting_value_to_ascii_value(mixed $value, string $ascii ); } - /** - * @dataProvider values_with_truncating - */ + #[DataProvider('values_with_truncating')] public function test_converting_value_to_ascii_value_with_truncating(mixed $value, string $asciiValue) : void { self::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/CastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/CastTest.php index 90a82d810..881a38117 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/CastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/CastTest.php @@ -8,6 +8,7 @@ use Flow\ETL\PHP\Value\Uuid; use Flow\ETL\Row; use Flow\ETL\Row\Factory\NativeEntryFactory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class CastTest extends TestCase @@ -48,9 +49,7 @@ public static function cast_provider() : array ]; } - /** - * @dataProvider cast_provider - */ + #[DataProvider('cast_provider')] public function test_cast(mixed $from, string $to, mixed $expected) : void { $resultRefCast = ref('value')->cast($to)->eval(Row::create((new NativeEntryFactory())->create('value', $from))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/PartitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/PartitionTest.php index 5bf5fac4c..5fc20d925 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/PartitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/PartitionTest.php @@ -8,6 +8,7 @@ use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\Partition; use Flow\ETL\Row\Entry\XMLEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class PartitionTest extends TestCase @@ -84,9 +85,7 @@ public function test_creating_partitions_from_uri_without_partitions() : void self::assertCount(0, $partitions); } - /** - * @dataProvider provider_forbidden_characters_values - */ + #[DataProvider('provider_forbidden_characters_values')] public function test_forbidden_names(string $value) : void { $this->expectException(InvalidArgumentException::class); @@ -94,9 +93,7 @@ public function test_forbidden_names(string $value) : void new Partition($value, 'value'); } - /** - * @dataProvider provider_forbidden_characters_values - */ + #[DataProvider('provider_forbidden_characters_values')] public function test_forbidden_values(string $value) : void { $this->expectException(InvalidArgumentException::class); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ArrayEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ArrayEntryTest.php index a3f196608..a3a523343 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ArrayEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ArrayEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\{ArrayEntry, IntegerEntry}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ArrayEntryTest extends TestCase @@ -83,9 +84,7 @@ public function test_entry_name_can_be_zero() : void self::assertSame('0', (new ArrayEntry('0', ['id' => 1]))->name()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, ArrayEntry $entry, ArrayEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/BooleanEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/BooleanEntryTest.php index a5a98b01f..7447933c3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/BooleanEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/BooleanEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\BooleanEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class BooleanEntryTest extends TestCase @@ -22,9 +23,7 @@ public function test_entry_name_can_be_zero() : void self::assertSame('0', (new BooleanEntry('0', true))->name()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, BooleanEntry $entry, BooleanEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/DateTimeEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/DateTimeEntryTest.php index 3f0c6038a..2c6f69e47 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/DateTimeEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/DateTimeEntryTest.php @@ -6,6 +6,7 @@ use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\Row\Entry\DateTimeEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class DateTimeEntryTest extends TestCase @@ -35,9 +36,7 @@ public function test_invalid_date() : void new DateTimeEntry('a', 'random string'); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, DateTimeEntry $entry, DateTimeEntry $nextEntry) : void { self::assertEquals($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/FloatEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/FloatEntryTest.php index a33a8691b..edd55a0fe 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/FloatEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/FloatEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\FloatEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class FloatEntryTest extends TestCase @@ -24,9 +25,7 @@ public function test_entry_name_can_be_zero() : void self::assertSame('0', (new FloatEntry('0', 0))->name()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, FloatEntry $entry, FloatEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/IntegerEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/IntegerEntryTest.php index 2ce1e5ba5..58ba8c2ca 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/IntegerEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/IntegerEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\IntegerEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class IntegerEntryTest extends TestCase @@ -22,9 +23,7 @@ public function test_entry_name_can_be_zero() : void self::assertSame('0', (new IntegerEntry('0', 0))->name()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, IntegerEntry $entry, IntegerEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonEntryTest.php index d274ce902..bec425376 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonEntryTest.php @@ -6,6 +6,7 @@ use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\Row\Entry\{IntegerEntry, JsonEntry}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class JsonEntryTest extends TestCase @@ -101,9 +102,7 @@ public function test_invalid_json() : void new JsonEntry('a', 'random string'); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, JsonEntry $entry, JsonEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonObjectEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonObjectEntryTest.php index c2d1f5a45..d1136879f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonObjectEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/JsonObjectEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\{IntegerEntry, JsonEntry}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class JsonObjectEntryTest extends TestCase @@ -53,9 +54,7 @@ public static function is_equal_data_provider() : \Generator ]; } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, JsonEntry $entry, JsonEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ObjectEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ObjectEntryTest.php index 91e5ad4cb..97cd11006 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ObjectEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/ObjectEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\ObjectEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class ObjectEntryTest extends TestCase @@ -22,9 +23,7 @@ public function test_entry_name_can_be_zero() : void self::assertSame('0', (new ObjectEntry('0', new \stdClass()))->name()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, ObjectEntry $entry, ObjectEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StringEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StringEntryTest.php index 4b459ab58..99a0af4d5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StringEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StringEntryTest.php @@ -5,6 +5,7 @@ namespace Flow\ETL\Tests\Unit\Row\Entry; use Flow\ETL\Row\Entry\StringEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class StringEntryTest extends TestCase @@ -32,9 +33,7 @@ public function test_creates_uppercase_value() : void self::assertEquals('IT SHOULD BE UPPERCASE', $entry->value()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, StringEntry $entry, StringEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StructureEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StructureEntryTest.php index d5d884828..f839f71a1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StructureEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/StructureEntryTest.php @@ -10,6 +10,7 @@ use Flow\ETL\PHP\Type\Logical\MapType; use Flow\ETL\Row\Entry\StructureEntry; use Flow\ETL\Row\Schema\Definition; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class StructureEntryTest extends TestCase @@ -166,9 +167,7 @@ public function test_entry_name_can_be_zero() : void ); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, StructureEntry $entry, StructureEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php index 0c3e7fd53..4e1fc04d1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php @@ -6,6 +6,7 @@ use Flow\ETL\PHP\Value\Uuid; use Flow\ETL\Row\Entry\UuidEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class UuidEntryTest extends TestCase @@ -49,9 +50,7 @@ protected function setUp() : void } } - /** - * @dataProvider valid_string_entries - */ + #[DataProvider('valid_string_entries')] public function test_creates_uuid_entry_from_string(string $value) : void { $entry = UuidEntry::from('entry-name', $value); @@ -59,9 +58,7 @@ public function test_creates_uuid_entry_from_string(string $value) : void self::assertEquals($value, $entry->value()->toString()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, UuidEntry $entry, UuidEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLEntryTest.php index 1f46ef073..1fcabda1e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLEntryTest.php @@ -7,6 +7,7 @@ use function Flow\ETL\DSL\xml_entry; use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\Row\Entry\XMLEntry; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class XMLEntryTest extends TestCase @@ -126,9 +127,7 @@ public function test_creating_xml_entry_with_empty_dom_document() : void self::assertSame("\n", $entry->__toString()); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, XMLEntry $entry, XMLEntry $nextEntry) : void { self::assertSame($equals, $entry->isEqual($nextEntry)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php index dd78526df..17eff86d8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php @@ -12,6 +12,7 @@ use Flow\ETL\Row\Entry\{ArrayEntry, BooleanEntry, DateTimeEntry, IntegerEntry, MapEntry, StringEntry, StructureEntry}; use Flow\ETL\Row\Schema; use Flow\ETL\Row\Schema\Definition; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class RowTest extends TestCase @@ -168,9 +169,7 @@ public function test_hash_empty_row() : void ); } - /** - * @dataProvider is_equal_data_provider - */ + #[DataProvider('is_equal_data_provider')] public function test_is_equal(bool $equals, \Flow\ETL\Row $row, \Flow\ETL\Row $nextRow) : void { self::assertSame($equals, $row->isEqual($nextRow)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/RowsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/RowsTest.php index f71cfb0df..3a8fafa24 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/RowsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/RowsTest.php @@ -13,6 +13,7 @@ use Flow\ETL\Row\Schema\Definition; use Flow\ETL\Row\{Comparator, Schema}; use Flow\ETL\{Row, Rows}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class RowsTest extends TestCase @@ -926,17 +927,13 @@ public function test_reverse() : void self::assertSame(1, $rows[2]->valueOf('id')); } - /** - * @dataProvider rows_diff_left_provider - */ + #[DataProvider('rows_diff_left_provider')] public function test_rows_diff_left(Rows $expected, Rows $left, Rows $right) : void { self::assertEquals($expected->toArray(), $left->diffLeft($right)->toArray()); } - /** - * @dataProvider rows_diff_right_provider - */ + #[DataProvider('rows_diff_right_provider')] public function test_rows_diff_right(Rows $expected, Rows $left, Rows $right) : void { self::assertEquals($expected->toArray(), $left->diffRight($right)->toArray()); @@ -993,9 +990,7 @@ public function test_rows_serialization() : void self::assertTrue($unserialized[2]->isEqual($rows[2])); } - /** - * @dataProvider unique_rows_provider - */ + #[DataProvider('unique_rows_provider')] public function test_rows_unique(Rows $expected, Rows $notUnique, Comparator $comparator = new NativeComparator()) : void { self::assertEquals($expected, $notUnique->unique($comparator)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Stream/PathTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Stream/PathTest.php index a1cc74d30..3815dce2b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Stream/PathTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Stream/PathTest.php @@ -7,6 +7,7 @@ use Flow\ETL\Exception\InvalidArgumentException; use Flow\ETL\Filesystem\Path; use Flow\ETL\{Partition, Partitions}; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class PathTest extends TestCase @@ -113,9 +114,7 @@ public function test_add_partitions_to_root_path_without_extension() : void ); } - /** - * @dataProvider directories - */ + #[DataProvider('directories')] public function test_directories(string $uri, string $dirPath) : void { self::assertSame($dirPath, (new Path($uri))->parentDirectory()->path()); @@ -135,9 +134,7 @@ public function test_extension() : void self::assertFalse((new Path(__DIR__))->extension()); } - /** - * @dataProvider paths_with_static_parts - */ + #[DataProvider('paths_with_static_parts')] public function test_finding_static_part_of_the_path(string $staticPart, string $uri) : void { self::assertEquals(new Path($staticPart), (new Path($uri))->staticPart()); @@ -148,9 +145,7 @@ public function test_local_file() : void self::assertNull((new Path(__FILE__))->context()->resource()); } - /** - * @dataProvider paths_pattern_matching - */ + #[DataProvider('paths_pattern_matching')] public function test_matching_pattern_with_path(string $path, string $pattern, bool $result) : void { self::assertSame($result, (new Path($path))->matches(new Path($pattern))); @@ -164,18 +159,14 @@ public function test_not_matching_items_under_directory_that_matches_pattern() : self::assertFalse($path->matches(new Path('flow-file://var/file/partition=1/file.csv'))); } - /** - * @dataProvider paths - */ + #[DataProvider('paths')] public function test_parsing_path(string $uri, string $schema, string $parsedUri) : void { self::assertEquals($schema, (new Path($uri))->scheme()); self::assertEquals($parsedUri, (new Path($uri))->uri()); } - /** - * @dataProvider paths_with_partitions - */ + #[DataProvider('paths_with_partitions')] public function test_partitions_in_path(string $uri, Partitions $partitions) : void { self::assertEquals($partitions, (new Path($uri))->partitions()); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php index 2ff6b3753..a6a71b4e0 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php @@ -8,6 +8,7 @@ use Flow\Doctrine\Bulk\DbalPlatform; use Flow\Doctrine\Bulk\Dialect\{MySQLDialect, PostgreSQLDialect, SqliteDialect}; use Flow\Doctrine\Bulk\Exception\RuntimeException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class DbalPlatformTest extends TestCase @@ -39,9 +40,7 @@ public function test_is_postgres_sql() : void self::assertInstanceOf(PostgreSQLDialect::class, $platform->dialect()); } - /** - * @dataProvider provideSQLitePlatform - */ + #[DataProvider('provideSQLitePlatform')] public function test_is_sqlite_sql(string $className) : void { if (\class_exists($className)) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Binary/BinaryReaderWriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Binary/BinaryReaderWriterTest.php index 1113a4446..a82a375e8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Binary/BinaryReaderWriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Binary/BinaryReaderWriterTest.php @@ -6,6 +6,7 @@ use Flow\Parquet\BinaryReader\BinaryBufferReader; use Flow\Parquet\BinaryWriter\BinaryBufferWriter; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class BinaryReaderWriterTest extends TestCase @@ -36,9 +37,7 @@ public static function decimalProvider() : array ]; } - /** - * @dataProvider decimalProvider - */ + #[DataProvider('decimalProvider')] public function test_writing_and_reading_decimals(array $decimals, int $precision, int $scale) : void { $bitsNeeded = \ceil(\log(10 ** $precision, 2)); diff --git a/src/lib/rdsl/tests/Flow/RDSL/Tests/Unit/NamespaceTest.php b/src/lib/rdsl/tests/Flow/RDSL/Tests/Unit/NamespaceTest.php index 7fdf7ba7e..41184f1df 100644 --- a/src/lib/rdsl/tests/Flow/RDSL/Tests/Unit/NamespaceTest.php +++ b/src/lib/rdsl/tests/Flow/RDSL/Tests/Unit/NamespaceTest.php @@ -7,6 +7,7 @@ use Flow\RDSL\AccessControl\AllowAll; use Flow\RDSL\DSLNamespace; use Flow\RDSL\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class NamespaceTest extends TestCase @@ -26,18 +27,14 @@ public static function valid_namespaces_provider() : \Generator yield ['\Foo\Bar\Baz']; } - /** - * @dataProvider invalid_namespaces_provider - */ + #[DataProvider('invalid_namespaces_provider')] public function test_invalid_namespaces(string $ns) : void { $this->expectException(InvalidArgumentException::class); new DSLNamespace($ns, new AllowAll()); } - /** - * @dataProvider valid_namespaces_provider - */ + #[DataProvider('valid_namespaces_provider')] public function test_valid_namespaces(string $ns) : void { self::assertInstanceOf(DSLNamespace::class, new DSLNamespace($ns, new AllowAll()));