From 9937c456fc3a8ce862986ae3462697fe863fc21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mleczko?= Date: Wed, 31 Jul 2024 00:22:08 +0200 Subject: [PATCH] Rename to RandomGenerator, introduce interface --- .../ElasticsearchExtractorTest.php | 10 ++-- .../ElasticsearchLoaderTest.php | 8 +-- .../MeilisearchExtractorTest.php | 6 +-- .../MeilisearchPHP/MeilisearchLoaderTest.php | 8 +-- .../Text/Tests/Integration/TextTest.php | 2 +- .../Unit/AzureBlobDestinationStreamTest.php | 4 +- .../etl/src/Flow/ETL/Config/ConfigBuilder.php | 2 +- ....php => NativePHPRandomValueGenerator.php} | 2 +- .../etl/src/Flow/ETL/RandomValueGenerator.php | 13 +++++ .../Flow/ETL/Tests/Double/FakeExtractor.php | 2 +- .../DataFrame/PartitioningTest.php | 8 +-- ... => NativePHPRandomValueGeneratorTest.php} | 18 +++---- .../etl/tests/Flow/ETL/Tests/Unit/RowTest.php | 4 +- .../OrderEntriesTransformerTest.php | 6 +-- .../Tests/Integration/MySqlBulkInsertTest.php | 6 +-- .../Integration/PostgreSqlBulkInsertTest.php | 6 +-- .../Integration/SqliteBulkInsertTest.php | 6 +-- .../filesystem/src/Flow/Filesystem/Path.php | 2 +- .../Block/NativeLocalFileBlocksFactory.php | 2 +- .../Tests/Integration/IO/CompressionTest.php | 48 ++++++++--------- .../Tests/Integration/IO/ListsWritingTest.php | 32 +++++------ .../Tests/Integration/IO/MapsWritingTest.php | 16 +++--- .../Tests/Integration/IO/PaginationTest.php | 8 +-- .../Integration/IO/SimpleTypesWritingTest.php | 54 +++++++++---------- .../Integration/IO/StructsWritingTest.php | 18 +++---- .../Tests/Integration/IO/WriterTest.php | 24 ++++----- .../Integration/IO/WriterValidatorTest.php | 18 +++---- .../Data/RLEBitPackedHybridTest.php | 4 +- .../RowGroupBuilder/PagesBuilderTest.php | 2 +- .../Snappy/Tests/Integration/SnappyTest.php | 2 +- 30 files changed, 177 insertions(+), 164 deletions(-) rename src/core/etl/src/Flow/ETL/{UniqueFactory.php => NativePHPRandomValueGenerator.php} (86%) create mode 100644 src/core/etl/src/Flow/ETL/RandomValueGenerator.php rename src/core/etl/tests/Flow/ETL/Tests/Unit/{UniqueFactoryTest.php => NativePHPRandomValueGeneratorTest.php} (75%) diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php index b2772eb39..badfd8892 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php @@ -40,7 +40,7 @@ public function test_empty_extraction() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 100) ), @@ -80,7 +80,7 @@ public function test_extraction_index_with_from_and_size() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 2000) ), @@ -123,7 +123,7 @@ public function test_extraction_index_with_search_after() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 2005) ), @@ -159,7 +159,7 @@ public function test_extraction_index_with_search_after_with_point_in_time() : v new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 2005) ), @@ -200,7 +200,7 @@ public function test_extraction_whole_index_with_point_in_time() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 2005) ), diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php index f766f121c..922c6bdd7 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php @@ -53,19 +53,19 @@ public function test_integration_with_entry_factory() : void $loader->load(new Rows( Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Łukasz') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Norbert') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Dawid') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Tomek') ), ), new FlowContext(Config::default())); diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php index dfde6d0ee..2c9d71be0 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php @@ -37,7 +37,7 @@ public function test_empty_extraction() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), \range(1, 100) ), @@ -63,7 +63,7 @@ public function test_extraction_index_with_from_and_size() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), // Default limit for Meilisearch is 1000 documents: https://www.meilisearch.com/docs/reference/api/settings#pagination \range(1, 999) @@ -102,7 +102,7 @@ public function test_extraction_index_with_sort() : void new Row\Entry\StringEntry('id', \sha1((string) $i)), new Row\Entry\IntegerEntry('position', $i), new Row\Entry\StringEntry('name', 'id_' . $i), - new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\UniqueFactory::int(0, 1)) + new Row\Entry\BooleanEntry('active', (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1)) ), // Default limit for Meilisearch is 1000 documents: https://www.meilisearch.com/docs/reference/api/settings#pagination \range(1, 999) diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php index 7d20ce830..62b648fe1 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php @@ -43,19 +43,19 @@ public function test_integration_with_entry_factory() : void $loader = to_meilisearch_bulk_index($this->meilisearchContext->clientConfig(), self::INDEX_NAME); $loader->load(new Rows( Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Łukasz') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Norbert') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Dawid') ), Row::create( - new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\UniqueFactory::string(32))), + new Row\Entry\StringEntry('id', \sha1('id' . \Flow\ETL\NativePHPRandomValueGenerator::string(32))), new Row\Entry\StringEntry('name', 'Tomek') ), ), new FlowContext(Config::default())); diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/TextTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/TextTest.php index b19334a1a..fbc2fc30d 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/TextTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/TextTest.php @@ -13,7 +13,7 @@ final class TextTest extends TestCase { public function test_loading_text_files() : void { - $path = __DIR__ . '/var/flow_php_etl_csv_loader' . \Flow\ETL\UniqueFactory::string(32) . '.csv'; + $path = __DIR__ . '/var/flow_php_etl_csv_loader' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.csv'; (new Flow()) ->process( diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobDestinationStreamTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobDestinationStreamTest.php index 077f7edcb..7bd9c80a7 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobDestinationStreamTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobDestinationStreamTest.php @@ -24,7 +24,7 @@ public function test_using_put_blob_with_content_when_data_is_larger_than_block_ $blockFactory->method('create') ->willReturnCallback( function () use ($blockSize) { - return new Block($id = \Flow\ETL\UniqueFactory::string(32), $blockSize, new Path(sys_get_temp_dir() . '/' . $id . '_block_01.txt')); + return new Block($id = \Flow\ETL\NativePHPRandomValueGenerator::string(32), $blockSize, new Path(sys_get_temp_dir() . '/' . $id . '_block_01.txt')); } ); @@ -74,7 +74,7 @@ public function test_using_put_blob_with_content_when_data_is_smaller_than_block $blockFactory->method('create') ->willReturnCallback( function () use ($blockSize) { - return new Block($id = \Flow\ETL\UniqueFactory::string(32), $blockSize, new Path(sys_get_temp_dir() . '/' . $id . '_block_01.txt')); + return new Block($id = \Flow\ETL\NativePHPRandomValueGenerator::string(32), $blockSize, new Path(sys_get_temp_dir() . '/' . $id . '_block_01.txt')); } ); $stream = AzureBlobDestinationStream::openBlank( diff --git a/src/core/etl/src/Flow/ETL/Config/ConfigBuilder.php b/src/core/etl/src/Flow/ETL/Config/ConfigBuilder.php index 65828c38c..34b3ae999 100644 --- a/src/core/etl/src/Flow/ETL/Config/ConfigBuilder.php +++ b/src/core/etl/src/Flow/ETL/Config/ConfigBuilder.php @@ -49,7 +49,7 @@ public function __construct() public function build() : Config { - $this->id ??= 'flow_php' . UniqueFactory::string(32); + $this->id ??= 'flow_php' . NativePHPRandomValueGenerator::string(32); $entryFactory = new NativeEntryFactory(); $this->serializer ??= new Base64Serializer(new NativePHPSerializer()); diff --git a/src/core/etl/src/Flow/ETL/UniqueFactory.php b/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php similarity index 86% rename from src/core/etl/src/Flow/ETL/UniqueFactory.php rename to src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php index 365318dcc..0c1ca5b82 100644 --- a/src/core/etl/src/Flow/ETL/UniqueFactory.php +++ b/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php @@ -4,7 +4,7 @@ namespace Flow\ETL; -final class UniqueFactory +final class NativePHPRandomValueGenerator implements RandomValueGenerator { private function __construct() { diff --git a/src/core/etl/src/Flow/ETL/RandomValueGenerator.php b/src/core/etl/src/Flow/ETL/RandomValueGenerator.php new file mode 100644 index 000000000..e4f3eedf8 --- /dev/null +++ b/src/core/etl/src/Flow/ETL/RandomValueGenerator.php @@ -0,0 +1,13 @@ + $int */ + public static function string(int $int) : string; +} diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php index 71c74e09c..195026be5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php @@ -50,7 +50,7 @@ public function extract(FlowContext $context) : \Generator yield rows( row( int_entry('int', $id), - float_entry('float', \Flow\ETL\UniqueFactory::int(100, 100000) / 100), + float_entry('float', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000) / 100), bool_entry('bool', false), datetime_entry('datetime', new \DateTimeImmutable('now')), str_entry('null', null), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/PartitioningTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/PartitioningTest.php index aab8df5e2..06cfe8b71 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/PartitioningTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/PartitioningTest.php @@ -163,13 +163,13 @@ public function test_partition_by_partitions_order() : void function (int $i) : array { $data = []; - $maxItems = \Flow\ETL\UniqueFactory::int(2, 10); + $maxItems = \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10); for ($d = 0; $d < $maxItems; $d++) { $data[] = [ - 'id' => \Flow\ETL\UniqueFactory::string(32), - 'created_at' => (new \DateTimeImmutable('2020-01-01'))->add(new \DateInterval('P' . $i . 'D'))->setTime(\Flow\ETL\UniqueFactory::int(0, 23), \Flow\ETL\UniqueFactory::int(0, 59), \Flow\ETL\UniqueFactory::int(0, 59)), - 'value' => \Flow\ETL\UniqueFactory::int(1, 1000), + 'id' => \Flow\ETL\NativePHPRandomValueGenerator::string(32), + 'created_at' => (new \DateTimeImmutable('2020-01-01'))->add(new \DateInterval('P' . $i . 'D'))->setTime(\Flow\ETL\NativePHPRandomValueGenerator::int(0, 23), \Flow\ETL\NativePHPRandomValueGenerator::int(0, 59), \Flow\ETL\NativePHPRandomValueGenerator::int(0, 59)), + 'value' => \Flow\ETL\NativePHPRandomValueGenerator::int(1, 1000), ]; } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/UniqueFactoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/NativePHPRandomValueGeneratorTest.php similarity index 75% rename from src/core/etl/tests/Flow/ETL/Tests/Unit/UniqueFactoryTest.php rename to src/core/etl/tests/Flow/ETL/Tests/Unit/NativePHPRandomValueGeneratorTest.php index 7d3680837..99be62182 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/UniqueFactoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/NativePHPRandomValueGeneratorTest.php @@ -4,10 +4,10 @@ namespace Flow\ETL\Tests\Unit; -use Flow\ETL\UniqueFactory; +use Flow\ETL\NativePHPRandomValueGenerator; use PHPUnit\Framework\TestCase; -final class UniqueFactoryTest extends TestCase +final class NativePHPRandomValueGeneratorTest extends TestCase { public static function integers_provider() : \Generator { @@ -35,9 +35,9 @@ public static function valid_range_provider() : array public function test_can_create_random_int_from_given_range() : void { - self::assertSame(1, (UniqueFactory::int(1, 1))); + self::assertSame(1, (NativePHPRandomValueGenerator::int(1, 1))); self::assertThat( - UniqueFactory::int(1, 2), + NativePHPRandomValueGenerator::int(1, 2), self::logicalOr( self::equalTo(1), self::equalTo(2) @@ -48,18 +48,18 @@ public function test_can_create_random_int_from_given_range() : void /** @dataProvider integers_provider */ public function test_can_create_random_string_with_given_length(int $expectedLength) : void { - self::assertSame($expectedLength, mb_strlen(UniqueFactory::string($expectedLength))); + self::assertSame($expectedLength, mb_strlen(NativePHPRandomValueGenerator::string($expectedLength))); } public function test_empty_string_on_length_below_1() : void { self::assertSame( '', - UniqueFactory::string(0) + NativePHPRandomValueGenerator::string(0) ); self::assertSame( '', - UniqueFactory::string(-1) + NativePHPRandomValueGenerator::string(-1) ); } @@ -67,14 +67,14 @@ public function test_empty_string_on_length_below_1() : void public function test_fail_on_invalid_range(int $min, int $max) : void { self::expectException(\ValueError::class); - UniqueFactory::int($min, $max); + NativePHPRandomValueGenerator::int($min, $max); } /** @dataProvider valid_range_provider */ public function test_return_random_int_on_valid_range(int $min, int $max) : void { self::assertThat( - UniqueFactory::int($min, $max), + NativePHPRandomValueGenerator::int($min, $max), self::logicalOr( self::greaterThanOrEqual($min), self::lessThanOrEqual($max) 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 a2099c400..a416d609c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/RowTest.php @@ -78,8 +78,8 @@ public static function is_equal_data_provider() : \Generator public function test_getting_schema_from_row() : void { $row = row( - int_entry('id', \Flow\ETL\UniqueFactory::int(100, 100000)), - float_entry('price', \Flow\ETL\UniqueFactory::int(100, 100000) / 100), + int_entry('id', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000)), + float_entry('price', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000) / 100), bool_entry('deleted', false), datetime_entry('created-at', new \DateTimeImmutable('now')), str_entry('phase', null), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/OrderEntriesTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/OrderEntriesTransformerTest.php index ae1cc8639..2e1adcfe3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/OrderEntriesTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/OrderEntriesTransformerTest.php @@ -46,8 +46,8 @@ public function test_ordering_entries_by_name_and_type() : void row( int_entry('int_a', 1), int_entry('int_b', 1), - float_entry('float_a', \Flow\ETL\UniqueFactory::int(100, 100000) / 100), - float_entry('float_b', \Flow\ETL\UniqueFactory::int(100, 100000) / 100), + float_entry('float_a', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000) / 100), + float_entry('float_b', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000) / 100), bool_entry('bool', false), bool_entry('bool_a', false), bool_entry('bool_c', false), @@ -141,7 +141,7 @@ public function test_ordering_entries_by_type() : void $rows = rows( row( int_entry('int', 1), - float_entry('float', \Flow\ETL\UniqueFactory::int(100, 100000) / 100), + float_entry('float', \Flow\ETL\NativePHPRandomValueGenerator::int(100, 100000) / 100), bool_entry('bool', false), datetime_entry('datetime', new \DateTimeImmutable('now')), str_entry('null', null), diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php index 4c0551dca..88780d4fd 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php @@ -33,9 +33,9 @@ public function test_inserts_multiple_rows_at_once() : void $this->databaseContext->connection(), $table, new BulkData([ - ['id' => $id1 = \Flow\ETL\UniqueFactory::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id2 = \Flow\ETL\UniqueFactory::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id3 = \Flow\ETL\UniqueFactory::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id1 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id2 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id3 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], ]) ); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php index a913b711a..ea6645dde 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php @@ -35,9 +35,9 @@ public function test_inserts_multiple_rows_at_once() : void $this->databaseContext->connection(), $table, new BulkData([ - ['id' => $id1 = \Flow\ETL\UniqueFactory::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1->format(\DateTimeInterface::ATOM), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id2 = \Flow\ETL\UniqueFactory::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id3 = \Flow\ETL\UniqueFactory::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id1 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1->format(\DateTimeInterface::ATOM), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id2 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id3 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], ]) ); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php index 5ed70e983..7404efc2c 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php @@ -33,9 +33,9 @@ public function test_inserts_multiple_rows_at_once() : void $this->databaseContext->connection(), $table, new BulkData([ - ['id' => $id1 = \Flow\ETL\UniqueFactory::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id2 = \Flow\ETL\UniqueFactory::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], - ['id' => $id3 = \Flow\ETL\UniqueFactory::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id1 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 20, 'name' => 'Name One', 'description' => 'Description One', 'active' => false, 'updated_at' => $date1 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id2 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 30, 'name' => 'Name Two', 'description' => null, 'active' => true, 'updated_at' => $date2 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], + ['id' => $id3 = \Flow\ETL\NativePHPRandomValueGenerator::string(10), 'age' => 40, 'name' => 'Name Three', 'description' => 'Description Three', 'active' => false, 'updated_at' => $date3 = new \DateTime(), 'tags' => \json_encode(['a', 'b', 'c'])], ]) ); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Path.php b/src/lib/filesystem/src/Flow/Filesystem/Path.php index 1eb4297cd..5c7248acf 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Path.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Path.php @@ -280,7 +280,7 @@ public function randomize() : self $base = \trim(\mb_substr($this->path(), 0, \mb_strrpos($this->path(), $this->basename())), DIRECTORY_SEPARATOR); return new self( - $this->protocol->scheme() . $base . DIRECTORY_SEPARATOR . $this->filename . '_' . \Flow\ETL\UniqueFactory::string(32) . $extension, + $this->protocol->scheme() . $base . DIRECTORY_SEPARATOR . $this->filename . '_' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . $extension, $this->options ); } diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php index 373c97275..1e38e6ec3 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php @@ -32,7 +32,7 @@ public function __construct(?string $blockLocation = null) public function create(int $size) : Block { - $id = \Flow\ETL\UniqueFactory::string(32); + $id = \Flow\ETL\NativePHPRandomValueGenerator::string(32); return new Block($id, $size, new Path($this->blockLocation . DIRECTORY_SEPARATOR . $id)); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php index 4622f82f8..394618d81 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php @@ -27,7 +27,7 @@ public function test_writing_and_reading_file_with_brotli_compression() : void self::markTestSkipped('The Brotli extension is not available'); } - $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::BROTLI); @@ -51,11 +51,11 @@ public function test_writing_and_reading_file_with_brotli_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -74,7 +74,7 @@ public function test_writing_and_reading_file_with_brotli_compression() : void public function test_writing_and_reading_file_with_gzip_compression() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::GZIP); @@ -98,11 +98,11 @@ public function test_writing_and_reading_file_with_gzip_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -126,7 +126,7 @@ public function test_writing_and_reading_file_with_lz4_compression() : void self::markTestSkipped('The lz4 extension is not available'); } - $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::LZ4); @@ -150,11 +150,11 @@ public function test_writing_and_reading_file_with_lz4_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -178,7 +178,7 @@ public function test_writing_and_reading_file_with_lz4_raw_compression() : void self::markTestSkipped('The lz4 extension is not available'); } - $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::LZ4_RAW); @@ -202,11 +202,11 @@ public function test_writing_and_reading_file_with_lz4_raw_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -230,7 +230,7 @@ public function test_writing_and_reading_file_with_snappy_compression() : void self::markTestSkipped('The snappy extension is not available'); } - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::SNAPPY); @@ -254,11 +254,11 @@ public function test_writing_and_reading_file_with_snappy_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -281,7 +281,7 @@ public function test_writing_and_reading_file_with_snappy_polyfill() : void self::markTestSkipped('The snappy extension is available'); } - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::SNAPPY); @@ -305,11 +305,11 @@ public function test_writing_and_reading_file_with_snappy_polyfill() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -328,7 +328,7 @@ public function test_writing_and_reading_file_with_snappy_polyfill() : void public function test_writing_and_reading_file_with_uncompressed_compression() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::UNCOMPRESSED); @@ -352,11 +352,11 @@ public function test_writing_and_reading_file_with_uncompressed_compression() : 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -380,7 +380,7 @@ public function test_writing_and_reading_file_with_zstd_compression() : void self::markTestSkipped('The Zstd extension is not available'); } - $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = \sys_get_temp_dir() . '/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(Compressions::ZSTD); @@ -404,11 +404,11 @@ public function test_writing_and_reading_file_with_zstd_compression() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php index bf5fe6365..ac5b58abc 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php @@ -21,7 +21,7 @@ protected function setUp() : void public function test_writing_empty_lists_of_ints() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); @@ -44,7 +44,7 @@ public function test_writing_empty_lists_of_ints() : void public function test_writing_list_of_ints() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); @@ -53,7 +53,7 @@ public function test_writing_list_of_ints() : void $inputData = \array_merge(...\array_map(static function (int $i) use ($faker) : array { return [ [ - 'list_of_ints' => \array_map(static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\UniqueFactory::int(2, 10))), + 'list_of_ints' => \array_map(static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))), ], ]; }, \range(1, 100))); @@ -68,7 +68,7 @@ public function test_writing_list_of_ints() : void public function test_writing_list_of_strings() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_strings', ListElement::string())); @@ -77,7 +77,7 @@ public function test_writing_list_of_strings() : void $inputData = \array_merge(...\array_map(static function (int $i) use ($faker) : array { return [ [ - 'list_of_strings' => \array_map(static fn ($i) => $faker->text(10), \range(1, \Flow\ETL\UniqueFactory::int(2, 10))), + 'list_of_strings' => \array_map(static fn ($i) => $faker->text(10), \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))), ], ]; }, \range(1, 100))); @@ -92,7 +92,7 @@ public function test_writing_list_of_strings() : void public function test_writing_list_of_structures() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with( @@ -111,7 +111,7 @@ public function test_writing_list_of_structures() : void 'list_of_structs' => \array_map(static fn ($i) => [ 'id' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'name' => $faker->text(10), - ], \range(1, \Flow\ETL\UniqueFactory::int(2, 10))), + ], \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))), ], ]; }, \range(1, 10))); @@ -126,7 +126,7 @@ public function test_writing_list_of_structures() : void public function test_writing_list_with_nullable_elements() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); @@ -136,7 +136,7 @@ public function test_writing_list_with_nullable_elements() : void return [ [ 'list_of_ints' => $i % 2 === 0 - ? \array_map(static fn ($a) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\UniqueFactory::int(2, 10))) + ? \array_map(static fn ($a) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))) : null, ], ]; @@ -152,7 +152,7 @@ public function test_writing_list_with_nullable_elements() : void public function test_writing_list_with_nullable_list_values() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); @@ -162,7 +162,7 @@ public function test_writing_list_with_nullable_list_values() : void return [ [ 'list_of_ints' => $i % 2 === 0 - ? \array_map(static fn ($a) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\UniqueFactory::int(2, 2))) + ? \array_map(static fn ($a) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 2))) : [null, null], ], ]; @@ -178,7 +178,7 @@ public function test_writing_list_with_nullable_list_values() : void public function test_writing_nullable_list_of_ints() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); @@ -188,7 +188,7 @@ public function test_writing_nullable_list_of_ints() : void return [ [ 'list_of_ints' => $i % 2 === 0 - ? \array_map(static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\UniqueFactory::int(2, 10))) + ? \array_map(static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))) : null, ], ]; @@ -204,7 +204,7 @@ public function test_writing_nullable_list_of_ints() : void public function test_writing_nullable_list_of_structures() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with( @@ -227,7 +227,7 @@ public function test_writing_nullable_list_of_structures() : void ? \array_map(static fn ($i) => [ 'id' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'name' => $faker->text(10), - ], \range(1, \Flow\ETL\UniqueFactory::int(2, 10))) + ], \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10))) : null, ], ]; @@ -243,7 +243,7 @@ public function test_writing_nullable_list_of_structures() : void public function test_writing_nullable_lists_of_ints() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::list('list_of_ints', ListElement::int32())); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php index aa208ba0b..70182b1c0 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php @@ -21,7 +21,7 @@ protected function setUp() : void public function test_writing_empty_map_of_int_int() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::map('map_int_int', MapKey::int32(), MapValue::int32())); @@ -44,7 +44,7 @@ public function test_writing_empty_map_of_int_int() : void public function test_writing_map_of_int_int() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::map('map_int_int', MapKey::int32(), MapValue::int32())); @@ -56,7 +56,7 @@ public function test_writing_map_of_int_int() : void 'map_int_int' => \array_merge( ...\array_map( static fn ($i) => [$i => $faker->numberBetween(0, Consts::PHP_INT32_MAX)], - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) ), ], @@ -73,7 +73,7 @@ public function test_writing_map_of_int_int() : void public function test_writing_map_of_int_int_with_all_maps_null() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::map('map_int_int', MapKey::int32(), MapValue::int32())); @@ -96,7 +96,7 @@ public function test_writing_map_of_int_int_with_all_maps_null() : void public function test_writing_map_of_int_string() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::map('map_int_string', MapKey::int32(), MapValue::string())); @@ -108,7 +108,7 @@ public function test_writing_map_of_int_string() : void 'map_int_string' => \array_merge( ...\array_map( static fn ($i) => [$i => $faker->text(10)], - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) ), ], @@ -125,7 +125,7 @@ public function test_writing_map_of_int_string() : void public function test_writing_nullable_map_of_int_int() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::map('map_int_int', MapKey::int32(), MapValue::int32())); @@ -138,7 +138,7 @@ public function test_writing_nullable_map_of_int_int() : void ? \array_merge( ...\array_map( static fn ($i) => [$i => $faker->numberBetween(0, Consts::PHP_INT32_MAX)], - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) ) : null, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php index 0faead760..da69dcbaa 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php @@ -125,12 +125,12 @@ private function generateDataset(string $path) : void 'created_at' => new \DateTimeImmutable('2024-01-01 + ' . $i . ' days'), 'list_of_int' => \array_map( static fn (int $i) => $i, - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'map_of_int_string' => \array_merge( ...\array_map( static fn (int $i) => [$i => 'value-' . $i], - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) ), 'struct' => [ @@ -140,12 +140,12 @@ private function generateDataset(string $path) : void 'created_at' => new \DateTimeImmutable('2024-01-01 + ' . $i . ' days'), 'list_of_int' => \array_map( static fn (int $i) => $i, - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'map_of_int_string' => \array_merge( ...\array_map( static fn (int $i) => [$i => 'value-' . $i], - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) ), ], diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php index 063bc3633..27efa5813 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php @@ -21,7 +21,7 @@ protected function setUp() : void public function test_writing_bool_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::boolean('boolean')); @@ -47,7 +47,7 @@ public function test_writing_bool_column() : void public function test_writing_bool_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::boolean('boolean')); @@ -55,7 +55,7 @@ public function test_writing_bool_nullable_column() : void $inputData = \array_merge(...\array_map(static function (int $i) : array { return [ [ - 'boolean' => $i % 2 == 0 ? (bool) \Flow\ETL\UniqueFactory::int(0, 1) : null, + 'boolean' => $i % 2 == 0 ? (bool) \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1) : null, ], ]; }, \range(1, 100))); @@ -73,7 +73,7 @@ public function test_writing_bool_nullable_column() : void public function test_writing_date_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::date('date')); @@ -101,7 +101,7 @@ public function test_writing_date_column() : void public function test_writing_date_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::date('date')); @@ -129,7 +129,7 @@ public function test_writing_date_nullable_column() : void public function test_writing_decimal_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::decimal('decimal')); @@ -157,7 +157,7 @@ public function test_writing_decimal_column() : void public function test_writing_decimal_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::decimal('decimal')); @@ -185,7 +185,7 @@ public function test_writing_decimal_nullable_column() : void public function test_writing_double_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::double('double')); @@ -213,7 +213,7 @@ public function test_writing_double_column() : void public function test_writing_double_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::double('double')); @@ -241,7 +241,7 @@ public function test_writing_double_nullable_column() : void public function test_writing_enum_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::enum('enum')); @@ -251,7 +251,7 @@ public function test_writing_enum_column() : void $inputData = \array_merge(...\array_map(static function (int $i) use ($enum) : array { return [ [ - 'enum' => $enum[\Flow\ETL\UniqueFactory::int(0, 3)], + 'enum' => $enum[\Flow\ETL\NativePHPRandomValueGenerator::int(0, 3)], ], ]; }, \range(1, 100))); @@ -269,7 +269,7 @@ public function test_writing_enum_column() : void public function test_writing_float_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::float('float')); @@ -295,7 +295,7 @@ public function test_writing_float_column() : void public function test_writing_float_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::float('float')); @@ -321,7 +321,7 @@ public function test_writing_float_nullable_column() : void public function test_writing_int32_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::int32('int32')); @@ -349,7 +349,7 @@ public function test_writing_int32_column() : void public function test_writing_int32_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::int32('int32')); @@ -377,7 +377,7 @@ public function test_writing_int32_nullable_column() : void public function test_writing_int64() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::int64('int64')); @@ -404,7 +404,7 @@ public function test_writing_int64() : void public function test_writing_int64_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::int64('int64')); @@ -431,7 +431,7 @@ public function test_writing_int64_nullable_column() : void public function test_writing_json_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::json('json')); @@ -458,7 +458,7 @@ public function test_writing_json_column() : void public function test_writing_json_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::json('json')); @@ -487,7 +487,7 @@ public function test_writing_json_nullable_column() : void public function test_writing_string_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::string('string')); @@ -514,7 +514,7 @@ public function test_writing_string_column() : void public function test_writing_string_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::string('string')); @@ -541,7 +541,7 @@ public function test_writing_string_nullable_column() : void public function test_writing_time_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::time('time')); @@ -566,7 +566,7 @@ public function test_writing_time_column() : void public function test_writing_time_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::time('time')); @@ -591,7 +591,7 @@ public function test_writing_time_nullable_column() : void public function test_writing_timestamp_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::dateTime('dateTime')); @@ -618,7 +618,7 @@ public function test_writing_timestamp_column() : void public function test_writing_timestamp_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::dateTime('dateTime')); @@ -645,7 +645,7 @@ public function test_writing_timestamp_nullable_column() : void public function test_writing_uuid_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::uuid('uuid')); @@ -672,7 +672,7 @@ public function test_writing_uuid_column() : void public function test_writing_uuid_nullable_column() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(FlatColumn::uuid('uuid')); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php index e59e9007a..ef7390118 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php @@ -21,7 +21,7 @@ protected function setUp() : void public function test_writing_flat_nullable_structure() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::struct('struct', [ @@ -45,11 +45,11 @@ public function test_writing_flat_nullable_structure() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ] : null, @@ -67,7 +67,7 @@ public function test_writing_flat_nullable_structure() : void public function test_writing_flat_structure() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::struct('struct', [ @@ -90,11 +90,11 @@ public function test_writing_flat_structure() : void 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ], @@ -111,7 +111,7 @@ public function test_writing_flat_structure() : void public function test_writing_flat_structure_with_nullable_elements() : void { - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $writer = new Writer(); $schema = Schema::with(NestedColumn::struct('struct', [ @@ -135,13 +135,13 @@ public function test_writing_flat_structure_with_nullable_elements() : void 'list_of_int' => $i % 2 === 0 ? \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) : null, 'list_of_string' => $i % 2 === 0 ? \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ) : null, ], diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php index 0d130dc46..4d83f0085 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php @@ -36,7 +36,7 @@ public function test_created_by_metadata() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); $writer->open($path, $schema); @@ -51,7 +51,7 @@ public function test_opening_already_open_writer() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); @@ -80,7 +80,7 @@ public function test_writing_column_statistics() : void ->set(Option::WRITER_VERSION, 1) ); - $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with($column = FlatColumn::int32('int32')); @@ -109,7 +109,7 @@ public function test_writing_data_page_v2_statistics() : void ->set(Option::WRITER_VERSION, 2) ); - $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with($column = FlatColumn::int32('int32')); @@ -136,7 +136,7 @@ public function test_writing_in_batches_to_file() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); @@ -163,7 +163,7 @@ public function test_writing_in_batches_to_file_without_explicit_close() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); @@ -189,7 +189,7 @@ public function test_writing_in_batches_to_stream() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); @@ -227,7 +227,7 @@ public function test_writing_to_file() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); $row = $this->createRow(); @@ -249,7 +249,7 @@ public function test_writing_to_file_v2() : void ->set(Option::WRITER_VERSION, 2) ); - $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-v2-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); $row = $this->createRow(); @@ -269,7 +269,7 @@ public function test_writing_to_stream() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = $this->createSchema(); $row = $this->createRow(); @@ -298,11 +298,11 @@ private function createRow() : array 'int32' => $faker->numberBetween(0, Consts::PHP_INT32_MAX), 'list_of_int' => \array_map( static fn ($i) => $faker->numberBetween(0, Consts::PHP_INT32_MAX), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), 'list_of_string' => \array_map( static fn ($i) => $faker->text(10), - \range(1, \Flow\ETL\UniqueFactory::int(2, 10)) + \range(1, \Flow\ETL\NativePHPRandomValueGenerator::int(2, 10)) ), ], ]; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php index f0d32c9aa..0ac701b1d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php @@ -22,7 +22,7 @@ public function test_skipping_required_row() : void $this->expectExceptionMessage('Column "string" is required'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with( Schema\FlatColumn::int32('id'), @@ -37,7 +37,7 @@ public function test_writing_int_value_to_string_column() : void $this->expectExceptionMessage('Column "string" is not string, got "integer" instead'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\FlatColumn::string('string')); @@ -49,7 +49,7 @@ public function test_writing_null_to_list_that_is_required() : void $this->expectExceptionMessage('Column "list" is required'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\NestedColumn::list('list', Schema\ListElement::string())->makeRequired()); @@ -61,7 +61,7 @@ public function test_writing_null_to_list_with_element_is_required() : void $this->expectExceptionMessage('Column "list.list.element" is not string, got "NULL" instead'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\NestedColumn::list('list', Schema\ListElement::string(required: true))); @@ -73,7 +73,7 @@ public function test_writing_null_to_map_with_value_required() : void $this->expectExceptionMessage('Column "map.key_value.value" is not string, got "NULL" instead'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\NestedColumn::map('map', Schema\MapKey::string(), Schema\MapValue::string(required: true))); @@ -85,7 +85,7 @@ public function test_writing_null_to_required_map() : void $this->expectExceptionMessage('Column "map" is required'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\NestedColumn::map('map', Schema\MapKey::string(), Schema\MapValue::string())->makeRequired()); @@ -97,7 +97,7 @@ public function test_writing_null_value_to_required_column() : void $this->expectExceptionMessage('Column "string" is required'); $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with(Schema\FlatColumn::string('string')->makeRequired()); @@ -107,7 +107,7 @@ public function test_writing_null_value_to_required_column() : void public function test_writing_row_with_missing_optional_columns() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with( Schema\FlatColumn::int32('id'), @@ -141,7 +141,7 @@ public function test_writing_row_with_missing_optional_columns() : void public function test_writing_row_with_missing_optional_columns_in_different_columns() : void { $writer = new Writer(); - $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\UniqueFactory::string(32) . '.parquet'; + $path = __DIR__ . '/var/test-writer-validator-parquet-test-' . \Flow\ETL\NativePHPRandomValueGenerator::string(32) . '.parquet'; $schema = Schema::with( Schema\FlatColumn::int32('id'), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/Data/RLEBitPackedHybridTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/Data/RLEBitPackedHybridTest.php index f4b73b2fd..63b631db1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/Data/RLEBitPackedHybridTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/Data/RLEBitPackedHybridTest.php @@ -230,10 +230,10 @@ public function test_with_dynamically_generated_values() : void { for ($iteration = 0; $iteration < 100; $iteration++) { $values = []; - $maxValues = \Flow\ETL\UniqueFactory::int(10, 1000); + $maxValues = \Flow\ETL\NativePHPRandomValueGenerator::int(10, 1000); for ($i = 0; $i < $maxValues; $i++) { - $values[] = \Flow\ETL\UniqueFactory::int(0, 1000); + $values[] = \Flow\ETL\NativePHPRandomValueGenerator::int(0, 1000); } $buffer = ''; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/RowGroupBuilder/PagesBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/RowGroupBuilder/PagesBuilderTest.php index 714676bb4..2cf3fb2d6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/RowGroupBuilder/PagesBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/ParquetFile/RowGroupBuilder/PagesBuilderTest.php @@ -58,7 +58,7 @@ public function test_building_pages_for_enum_columns() : void 1 => 'GREEN', 2 => 'BLUE', ]; - $values = \array_map(static fn ($i) => $enum[\Flow\ETL\UniqueFactory::int(0, 2)], \range(0, 99)); + $values = \array_map(static fn ($i) => $enum[\Flow\ETL\NativePHPRandomValueGenerator::int(0, 2)], \range(0, 99)); $statistics = new ColumnChunkStatistics($column); foreach ($values as $value) { diff --git a/src/lib/snappy/tests/Flow/Snappy/Tests/Integration/SnappyTest.php b/src/lib/snappy/tests/Flow/Snappy/Tests/Integration/SnappyTest.php index 2273ade6a..1d4abf2bb 100644 --- a/src/lib/snappy/tests/Flow/Snappy/Tests/Integration/SnappyTest.php +++ b/src/lib/snappy/tests/Flow/Snappy/Tests/Integration/SnappyTest.php @@ -71,7 +71,7 @@ public function test_snappy_compression_with_dynamically_generated_texts() : voi $snappy = new Snappy(); for ($iteration = 0; $iteration < 100; $iteration++) { - $string = Factory::create()->text(\Flow\ETL\UniqueFactory::int(10, 1000)); + $string = Factory::create()->text(\Flow\ETL\NativePHPRandomValueGenerator::int(10, 1000)); self::assertSame( $string,