From 4f96d2f4514d005cd75325bc1adc2c6e8018b165 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 31 Jul 2025 11:56:51 +0300 Subject: [PATCH 01/10] chore: increase test coverage --- .../MartinGeorgiev/Utils/DoctrineOrmTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/Unit/MartinGeorgiev/Utils/DoctrineOrmTest.php diff --git a/tests/Unit/MartinGeorgiev/Utils/DoctrineOrmTest.php b/tests/Unit/MartinGeorgiev/Utils/DoctrineOrmTest.php new file mode 100644 index 00000000..e11cc5b2 --- /dev/null +++ b/tests/Unit/MartinGeorgiev/Utils/DoctrineOrmTest.php @@ -0,0 +1,22 @@ + Date: Thu, 31 Jul 2025 20:18:12 +0300 Subject: [PATCH 02/10] unify test method names style --- .../ORM/Query/AST/Functions/ArrayPositionTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/DateAddTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/DateSubtractTest.php | 9 ++++++--- .../Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/JsonbPathExistsTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/JsonbPathMatchTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php | 9 ++++++--- .../ORM/Query/AST/Functions/JsonbPathQueryTest.php | 9 ++++++--- .../Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php | 9 ++++++--- .../Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php | 6 ++++-- .../ORM/Query/AST/Functions/RegexpReplaceTest.php | 6 ++++-- .../ORM/Query/AST/Functions/RegexpSubstrTest.php | 6 ++++-- .../Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php | 6 ++++-- 18 files changed, 90 insertions(+), 45 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php index 392e6c41..1ede3db5 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php @@ -43,7 +43,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('array_position() requires at least 2 arguments'); @@ -52,7 +53,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('array_position() requires between 2 and 3 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php index 6e357898..5cea1729 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php @@ -40,7 +40,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for array_to_json. Must be "true" or "false".'); @@ -49,7 +50,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('array_to_json() requires between 1 and 2 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php index f3a199d8..fe3b915a 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_timezone_throws_exception(): void + #[Test] + public function invalid_timezone_throws_exception(): void { $this->expectException(InvalidTimezoneException::class); $this->expectExceptionMessage('Invalid timezone "Invalid/Timezone" provided for date_add'); @@ -53,7 +54,8 @@ public function test_invalid_timezone_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('date_add() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('date_add() requires between 2 and 3 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php index 81c290d3..1b35d60c 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php @@ -42,7 +42,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_timezone_throws_exception(): void + #[Test] + public function invalid_timezone_throws_exception(): void { $this->expectException(InvalidTimezoneException::class); $this->expectExceptionMessage('Invalid timezone "Invalid/Timezone" provided for date_subtract'); @@ -51,7 +52,8 @@ public function test_invalid_timezone_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('date_subtract() requires at least 2 arguments'); @@ -60,7 +62,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('date_subtract() requires between 2 and 3 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php index 8a411beb..1c5f5fa9 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php @@ -34,7 +34,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_insert. Must be "true" or "false".'); @@ -43,7 +44,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_insert() requires at least 3 arguments'); @@ -52,7 +54,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_insert() requires between 3 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php index 91cdc1b7..5661d538 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_path_exists. Must be "true" or "false".'); @@ -53,7 +54,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_exists() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_exists() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php index aae75158..97410c5a 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_path_match. Must be "true" or "false".'); @@ -53,7 +54,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_match() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_match() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php index 792dc692..3bdb0e7c 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_path_query_array. Must be "true" or "false".'); @@ -53,7 +54,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query_array() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query_array() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php index e8dde9b9..c528e3d7 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_path_query_first. Must be "true" or "false".'); @@ -53,7 +54,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query_first() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query_first() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php index 2a754501..e365012f 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php @@ -44,7 +44,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_path_query. Must be "true" or "false".'); @@ -53,7 +54,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query() requires at least 2 arguments'); @@ -62,7 +64,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_path_query() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php index 2e74592b..360e8f10 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php @@ -40,7 +40,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for jsonb_set. Must be "true" or "false".'); @@ -49,7 +50,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_set() requires at least 3 arguments'); @@ -58,7 +60,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('jsonb_set() requires between 3 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php index aed1f93d..0ad17288 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php @@ -43,7 +43,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_count() requires at least 2 arguments'); @@ -52,7 +53,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_count() requires between 2 and 4 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php index 0003deaf..308b25d7 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php @@ -49,7 +49,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_instr() requires at least 2 arguments'); @@ -58,7 +59,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_instr() requires between 2 and 7 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php index 808549d3..82f3baf3 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php @@ -39,7 +39,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_like() requires at least 2 arguments'); @@ -48,7 +49,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_like() requires between 2 and 3 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php index eb718418..72a741f6 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php @@ -39,7 +39,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_match() requires at least 2 arguments'); @@ -48,7 +49,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_match() requires between 2 and 3 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php index 7126cdb8..2e2c1f08 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php @@ -45,7 +45,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_replace() requires at least 3 arguments'); @@ -54,7 +55,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_replace() requires between 3 and 6 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php index e1eabeef..43fe7798 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php @@ -45,7 +45,8 @@ protected function getDqlStatements(): array ]; } - public function test_too_few_arguments_throws_exception(): void + #[Test] + public function too_few_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_substr() requires at least 2 arguments'); @@ -54,7 +55,8 @@ public function test_too_few_arguments_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('regexp_substr() requires between 2 and 6 arguments'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php index e811a835..e70f4419 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php @@ -42,7 +42,8 @@ protected function getDqlStatements(): array ]; } - public function test_invalid_boolean_throws_exception(): void + #[Test] + public function invalid_boolean_throws_exception(): void { $this->expectException(InvalidBooleanException::class); $this->expectExceptionMessage('Invalid boolean value "invalid" provided for row_to_json. Must be "true" or "false".'); @@ -51,7 +52,8 @@ public function test_invalid_boolean_throws_exception(): void $this->buildEntityManager()->createQuery($dql)->getSQL(); } - public function test_too_many_arguments_throws_exception(): void + #[Test] + public function too_many_arguments_throws_exception(): void { $this->expectException(InvalidArgumentForVariadicFunctionException::class); $this->expectExceptionMessage('row_to_json() requires between 1 and 2 arguments'); From 35c8a8333e8ea90eaa6f9b39817fbe7b1e912d84 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 00:12:33 +0300 Subject: [PATCH 03/10] no message --- .../Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/DateAddTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php | 1 + .../Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php | 1 + 18 files changed, 18 insertions(+) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php index 1ede3db5..baf979c0 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPositionTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayPosition; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; +use PHPUnit\Framework\Attributes\Test; class ArrayPositionTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php index 5cea1729..1a9c30ef 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; +use PHPUnit\Framework\Attributes\Test; class ArrayToJsonTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php index fe3b915a..095a2df8 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateAddTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateAdd; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidTimezoneException; +use PHPUnit\Framework\Attributes\Test; class DateAddTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php index 1b35d60c..5d6d4c06 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateSubtractTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateSubtract; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidTimezoneException; +use PHPUnit\Framework\Attributes\Test; class DateSubtractTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php index 1c5f5fa9..cb67a3b3 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbInsertTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbInsert; +use PHPUnit\Framework\Attributes\Test; class JsonbInsertTest extends TestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php index 5661d538..6e88f696 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathExistsTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathExists; +use PHPUnit\Framework\Attributes\Test; class JsonbPathExistsTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php index 97410c5a..91ba190d 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathMatchTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathMatch; +use PHPUnit\Framework\Attributes\Test; class JsonbPathMatchTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php index 3bdb0e7c..009a5b8c 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryArrayTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQueryArray; +use PHPUnit\Framework\Attributes\Test; class JsonbPathQueryArrayTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php index c528e3d7..fc70b0de 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryFirstTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQueryFirst; +use PHPUnit\Framework\Attributes\Test; class JsonbPathQueryFirstTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php index e365012f..6cb99489 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbPathQueryTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQuery; +use PHPUnit\Framework\Attributes\Test; class JsonbPathQueryTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php index 360e8f10..270c7464 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbSetTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbSet; +use PHPUnit\Framework\Attributes\Test; class JsonbSetTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php index 0ad17288..6eed6edb 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpCountTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpCount; +use PHPUnit\Framework\Attributes\Test; class RegexpCountTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php index 308b25d7..22a2b308 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpInstrTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpInstr; +use PHPUnit\Framework\Attributes\Test; class RegexpInstrTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php index 82f3baf3..1c64f5bf 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpLikeTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpLike; +use PHPUnit\Framework\Attributes\Test; class RegexpLikeTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php index 72a741f6..d3b82dcb 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpMatchTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpMatch; +use PHPUnit\Framework\Attributes\Test; class RegexpMatchTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php index 2e2c1f08..ac37f9a8 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpReplaceTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpReplace; +use PHPUnit\Framework\Attributes\Test; class RegexpReplaceTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php index 43fe7798..fdc9f701 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RegexpSubstrTest.php @@ -8,6 +8,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpSubstr; +use PHPUnit\Framework\Attributes\Test; class RegexpSubstrTest extends BaseVariadicFunctionTestCase { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php index e70f4419..e57ba503 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php @@ -9,6 +9,7 @@ use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidBooleanException; use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RowToJson; +use PHPUnit\Framework\Attributes\Test; class RowToJsonTest extends BaseVariadicFunctionTestCase { From 0ef539ab68e594459c8ba0134ce8bee9284ccc91 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 00:24:32 +0300 Subject: [PATCH 04/10] no message --- .../Doctrine/DBAL/Types/CidrArrayTest.php | 4 ++-- .../Doctrine/DBAL/Types/MacaddrTest.php | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php index 60b98ace..833174e4 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php @@ -103,7 +103,7 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation')] + #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] #[Test] public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void { @@ -114,7 +114,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array + public static function provideInvalidDatabaseValuesForPHPTransformation(): array { return [ 'invalid format' => ['{"invalid-cidr"}'], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php index 62370a04..f1c03865 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php @@ -36,57 +36,57 @@ public function has_name(): void #[DataProvider('provideValidTransformations')] #[Test] - public function can_transform_from_php_value(?string $phpInput, ?string $postgresValueAfterNormalisation, ?string $phpValueAfterRetrievalFromDatabase): void + public function can_transform_from_php_value(?string $phpInput, ?string $postgresValueAfterNormalization, ?string $phpValueAfterRetrievalFromDatabase): void { - self::assertEquals($postgresValueAfterNormalisation, $this->fixture->convertToDatabaseValue($phpInput, $this->platform)); + self::assertEquals($postgresValueAfterNormalization, $this->fixture->convertToDatabaseValue($phpInput, $this->platform)); } #[DataProvider('provideValidTransformations')] #[Test] - public function can_transform_to_php_value(?string $phpInput, ?string $postgresValueAfterNormalisation, ?string $phpValueAfterRetrievalFromDatabase): void + public function can_transform_to_php_value(?string $phpInput, ?string $postgresValueAfterNormalization, ?string $phpValueAfterRetrievalFromDatabase): void { - self::assertEquals($phpValueAfterRetrievalFromDatabase, $this->fixture->convertToPHPValue($postgresValueAfterNormalisation, $this->platform)); + self::assertEquals($phpValueAfterRetrievalFromDatabase, $this->fixture->convertToPHPValue($postgresValueAfterNormalization, $this->platform)); } /** - * @return array + * @return array */ public static function provideValidTransformations(): array { return [ 'null' => [ 'phpInput' => null, - 'postgresValueAfterNormalisation' => null, + 'postgresValueAfterNormalization' => null, 'phpValueAfterRetrievalFromDatabase' => null, ], 'colon-separated lowercase' => [ 'phpInput' => '08:00:2b:01:02:03', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], 'colon-separated uppercase' => [ 'phpInput' => '08:00:2B:01:02:03', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], 'hyphen-separated lowercase' => [ 'phpInput' => '08-00-2b-01-02-03', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], 'hyphen-separated uppercase' => [ 'phpInput' => '08-00-2B-01-02-03', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], 'no separator' => [ 'phpInput' => '08002B010203', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], 'mixed case no separator' => [ 'phpInput' => '08002b010203', - 'postgresValueAfterNormalisation' => '08:00:2b:01:02:03', + 'postgresValueAfterNormalization' => '08:00:2b:01:02:03', 'phpValueAfterRetrievalFromDatabase' => '08:00:2b:01:02:03', ], ]; From 9606351742a7595755f88e1368aae484a7addd3e Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 00:35:55 +0300 Subject: [PATCH 05/10] no message --- .../Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php | 2 +- .../MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php | 6 +++--- .../MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php | 2 +- .../DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php index 5ee2b46c..51685aba 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php @@ -57,7 +57,7 @@ public function has_name(): void #[Test] #[DataProvider('provideValidTransformations')] - public function can_convert_to_php_value(?array $phpValue, ?string $postgresValue): void + public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void { self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform)); } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php index 47e73fa8..75395985 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php @@ -49,7 +49,7 @@ public function throws_exception_when_getting_sql_declaration_with_no_type_name( } #[Test] - public function returns_correct_type_name(): void + public function can_return_correct_type_name(): void { $type = new class extends BaseType { protected const TYPE_NAME = 'custom_type'; @@ -59,7 +59,7 @@ public function returns_correct_type_name(): void } #[Test] - public function gets_correct_sql_declaration(): void + public function can_get_correct_sql_declaration(): void { $type = new class extends BaseType { protected const TYPE_NAME = 'custom_type'; @@ -76,7 +76,7 @@ public function gets_correct_sql_declaration(): void } #[Test] - public function requires_sql_comment_hint_returns_false(): void + public function can_return_false_for_sql_comment_hint_requirement(): void { $type = new class extends BaseType { protected const TYPE_NAME = 'custom_type'; diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php index 9fa4a8ae..1951aff8 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php @@ -183,7 +183,7 @@ public function handles_edge_case_with_empty_and_malformed_arrays(): void } #[Test] - public function returns_empty_array_for_non_standard_postgres_array_format(): void + public function can_return_empty_array_for_non_standard_postgres_array_format(): void { $result1 = $this->fixture->convertToPHPValue('[test]', $this->platform); $result2 = $this->fixture->convertToPHPValue('not-an-array', $this->platform); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php index 4a893843..9c54a134 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/BaseTimestampRangeTestCase.php @@ -11,8 +11,7 @@ /** * Base test case for timestamp range types (TsRange, TstzRange). * Provides common timestamp-specific test patterns. - */ -/** + * * @template R of \DateTimeInterface */ abstract class BaseTimestampRangeTestCase extends BaseRangeTestCase From 0d513e3db6d01886b17a5e84eab73e54f6508ba8 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 00:52:28 +0300 Subject: [PATCH 06/10] no message --- .../MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php | 2 +- .../Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php | 2 +- .../MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php | 8 ++++---- .../Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php | 4 ++-- .../Doctrine/DBAL/Types/ValueObject/Int4RangeTest.php | 6 +++--- .../Doctrine/DBAL/Types/ValueObject/TsRangeTest.php | 2 +- .../Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php index 77611063..68e857ad 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php @@ -77,7 +77,7 @@ public static function provideValidTransformations(): array } #[Test] - public function throws_invalid_argument_exception_when_php_value_is_not_array(): void + public function throws_exception_when_php_value_is_not_array(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessageMatches('/Given PHP value content type is not PHP array. Instead it is "\w+"./'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php index 51685aba..f688787d 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseNetworkTypeArrayTest.php @@ -112,7 +112,7 @@ public static function provideInvalidValues(): array } #[Test] - public function transform_array_item_for_php_handles_valid_string(): void + public function can_transform_array_item_for_php_with_valid_string(): void { $this->assertSame('valid_address', $this->fixture->transformArrayItemForPHP('"valid_address"')); } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php index 1951aff8..b5b9c2a2 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php @@ -171,7 +171,7 @@ public function throws_exception_for_malformed_point_strings_in_database(): void } #[Test] - public function handles_edge_case_with_empty_and_malformed_arrays(): void + public function can_handle_edge_case_with_empty_and_malformed_arrays(): void { $result1 = $this->fixture->convertToPHPValue('{}', $this->platform); $result2 = $this->fixture->convertToPHPValue('{invalid}', $this->platform); @@ -193,14 +193,14 @@ public function can_return_empty_array_for_non_standard_postgres_array_format(): } #[Test] - public function transform_array_item_for_php_returns_null_for_null(): void + public function can_transform_array_item_for_php_returning_null_for_null(): void { $this->assertNull($this->fixture->transformArrayItemForPHP(null)); } #[Test] #[DataProvider('provideInvalidTypes')] - public function transform_array_item_for_php_throws_for_invalid_type(mixed $value): void + public function can_transform_array_item_for_php_throwing_for_invalid_type(mixed $value): void { $this->expectException(InvalidPointArrayItemForPHPException::class); $this->fixture->transformArrayItemForPHP($value); @@ -208,7 +208,7 @@ public function transform_array_item_for_php_throws_for_invalid_type(mixed $valu #[Test] #[DataProvider('provideInvalidTypes')] - public function transform_postgres_array_to_php_array_returns_empty_for_invalid_format(mixed $value): void + public function can_transform_postgres_array_to_php_array_returning_empty_for_invalid_format(mixed $value): void { $reflectionObject = new \ReflectionObject($this->fixture); $reflectionMethod = $reflectionObject->getMethod('transformPostgresArrayToPHPArray'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php index 82f2486a..ef894d94 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php @@ -124,7 +124,7 @@ public static function provideInvalidDatabaseValues(): array } #[Test] - public function allows_coordinate_with_exactly_6_decimal_places(): void + public function can_allow_coordinate_with_exactly_6_decimal_places(): void { $point = new PointValueObject(1.123456, 2.654321); $this->assertSame(1.123456, $point->getX()); @@ -132,7 +132,7 @@ public function allows_coordinate_with_exactly_6_decimal_places(): void } #[Test] - public function throws_for_coordinate_with_more_than_6_decimal_places(): void + public function throws_exception_for_coordinate_with_more_than_6_decimal_places(): void { $this->expectException(\InvalidArgumentException::class); new PointValueObject(1.1234567, 2.0); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Int4RangeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Int4RangeTest.php index ec5c84ed..1cb43be2 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Int4RangeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/Int4RangeTest.php @@ -110,7 +110,7 @@ public static function provideFromStringTestCases(): \Generator } #[Test] - public function validates_int4_bounds_for_lower(): void + public function can_validate_int4_bounds_for_lower(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Lower bound -2147483649 is outside INT4 range'); @@ -119,7 +119,7 @@ public function validates_int4_bounds_for_lower(): void } #[Test] - public function validates_int4_bounds_for_upper(): void + public function can_validate_int4_bounds_for_upper(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Upper bound 2147483648 is outside INT4 range'); @@ -128,7 +128,7 @@ public function validates_int4_bounds_for_upper(): void } #[Test] - public function allows_max_int4_values(): void + public function can_allow_max_int4_values(): void { $int4Range = new Int4Range(-2147483648, 2147483647); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TsRangeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TsRangeTest.php index a52b2361..a2f3f4d2 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TsRangeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TsRangeTest.php @@ -219,7 +219,7 @@ public static function provideFromStringTestCases(): \Generator } #[Test] - public function handles_microseconds_correctly(): void + public function can_handle_microseconds_correctly(): void { $start = new \DateTimeImmutable('2023-01-01 10:00:00.123456'); $end = new \DateTimeImmutable('2023-01-01 18:00:00.654321'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php index bdba6e0c..57bd0384 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php @@ -159,7 +159,7 @@ public static function provideFromStringTestCases(): \Generator } #[Test] - public function handles_different_timezones(): void + public function can_handle_different_timezones(): void { $start = new \DateTimeImmutable('2023-01-01 10:00:00+02:00'); $end = new \DateTimeImmutable('2023-01-01 18:00:00-05:00'); @@ -169,7 +169,7 @@ public function handles_different_timezones(): void } #[Test] - public function handles_microseconds_with_timezone(): void + public function can_handle_microseconds_with_timezone(): void { $start = new \DateTimeImmutable('2023-01-01 10:00:00.123456+00:00'); $end = new \DateTimeImmutable('2023-01-01 18:00:00.654321+00:00'); @@ -233,7 +233,7 @@ public function throws_exception_for_invalid_timestamp_string_via_from_string(): } #[Test] - public function preserves_timezone_information(): void + public function can_preserve_timezone_information(): void { $timestampWithTz = new \DateTimeImmutable('2023-01-01 10:00:00+02:00'); $tstzRange = new TstzRange($timestampWithTz, null); From e179d2ae94195f700e16231970de6b6984bfeb58 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 01:10:56 +0300 Subject: [PATCH 07/10] no message --- .../MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php | 7 +++++-- .../MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php | 5 ++++- .../Doctrine/DBAL/Types/DoublePrecisionArrayTest.php | 5 ++++- .../MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php | 5 ++++- .../Doctrine/DBAL/Types/IntegerArrayTest.php | 7 +++++-- .../MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php | 5 ++++- .../Doctrine/DBAL/Types/MacaddrArrayTest.php | 7 +++++-- .../MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php | 5 ++++- .../MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php | 5 ++++- .../Doctrine/DBAL/Types/SmallIntArrayTest.php | 7 +++++-- 10 files changed, 44 insertions(+), 14 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php index 8daf4a9a..be2ccac8 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php @@ -33,7 +33,10 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array } /** - * @return array + * @return list */ public static function provideValidTransformations(): array { @@ -76,7 +79,7 @@ public function throws_domain_exception_when_value_exceeds_range(string $outOfRa } /** - * @return array + * @return list */ public static function provideOutOfRangeValues(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php index 833174e4..00b331b7 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php @@ -48,7 +48,10 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa } /** - * @return array + * @return array */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php index 6962592d..e071fff3 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php @@ -35,7 +35,10 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array } /** - * @return array + * @return list */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php index 719c31fc..c82beea2 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php @@ -48,7 +48,10 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa } /** - * @return array + * @return array */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php index ea27d6f1..7133a4af 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php @@ -31,7 +31,10 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array } /** - * @return array + * @return list */ public static function provideValidTransformations(): array { @@ -64,7 +67,7 @@ public static function provideValidTransformations(): array } /** - * @return array + * @return list */ public static function provideOutOfRangeValues(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php index 864bdbeb..9de223d7 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php @@ -49,7 +49,10 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa } /** - * @return list> + * @return list */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php index f68a1ec2..81d104d1 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php @@ -48,7 +48,10 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa } /** - * @return array + * @return array */ public static function provideValidTransformations(): array { @@ -89,7 +92,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa } /** - * @return array + * @return array */ public static function provideInvalidPHPValuesForDatabaseTransformation(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php index b5b9c2a2..c3b625e2 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php @@ -49,7 +49,10 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa } /** - * @return array|null, postgresValue: string|null}> + * @return array|null, + * postgresValue: string|null + * }> */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php index 34b50ec9..63feb5ff 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php @@ -35,7 +35,10 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array } /** - * @return array + * @return list */ public static function provideValidTransformations(): array { diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php index 0800f087..f39f693d 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php @@ -31,7 +31,10 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array } /** - * @return array + * @return list */ public static function provideValidTransformations(): array { @@ -64,7 +67,7 @@ public static function provideValidTransformations(): array } /** - * @return array + * @return list */ public static function provideOutOfRangeValues(): array { From 0fab3274a08fe847733994e9e6235058c80b870e Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Fri, 1 Aug 2025 09:14:55 +0300 Subject: [PATCH 08/10] no message --- .../Doctrine/DBAL/Types/BaseRangeTestCase.php | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php index 32b0af08..f29dfed3 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php @@ -108,22 +108,48 @@ public function can_handle_empty_string_from_sql(): void self::assertNull($result); } + #[DataProvider('provideInvalidDatabaseValues')] #[Test] - public function throws_exception_for_invalid_php_value_type(): void + public function throws_exception_when_converting_to_database_value_for_invalid_types(mixed $invalidValue): void { $this->expectException(InvalidRangeForDatabaseException::class); $this->expectExceptionMessage('Invalid type for range'); - $this->fixture->convertToDatabaseValue('invalid', $this->platform); // @phpstan-ignore-line argument.type + $this->fixture->convertToDatabaseValue($invalidValue, $this->platform); // @phpstan-ignore-line argument.type } + /** + * @return array + */ + public static function provideInvalidDatabaseValues(): array + { + return [ + 'string value' => ['not_a_range'], + 'integer value' => [123], + 'array value' => [[1, 2, 3]], + ]; + } + + #[DataProvider('provideInvalidPHPValues')] #[Test] - public function throws_exception_for_invalid_sql_value_type(): void + public function throws_exception_when_converting_to_php_value_for_invalid_types(mixed $invalidValue): void { $this->expectException(InvalidRangeForPHPException::class); $this->expectExceptionMessage('Invalid database value type for range conversion'); - $this->fixture->convertToPHPValue([1, 2], $this->platform); // @phpstan-ignore-line argument.type + $this->fixture->convertToPHPValue($invalidValue, $this->platform); // @phpstan-ignore-line argument.type + } + + /** + * @return array + */ + public static function provideInvalidPHPValues(): array + { + return [ + 'integer value' => [123], + 'array value' => [['invalid']], + 'boolean value' => [true], + ]; } #[Test] From ed9319c3709296465d56793d99de3c11ff3acebd Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Sat, 2 Aug 2025 01:59:46 +0300 Subject: [PATCH 09/10] no message --- .../Doctrine/DBAL/Types/CidrArrayTest.php | 16 ++-- .../Doctrine/DBAL/Types/CidrTest.php | 12 +-- .../Doctrine/DBAL/Types/InetArrayTest.php | 12 +-- .../Doctrine/DBAL/Types/InetTest.php | 18 ++-- .../Doctrine/DBAL/Types/JsonbTest.php | 94 +++++++++++++++++-- .../Doctrine/DBAL/Types/MacaddrArrayTest.php | 12 +-- .../Doctrine/DBAL/Types/MacaddrTest.php | 51 ++++++++-- .../Doctrine/DBAL/Types/PointArrayTest.php | 33 ++++--- .../Doctrine/DBAL/Types/PointTest.php | 19 ++-- 9 files changed, 200 insertions(+), 67 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php index 00b331b7..7a78c4e4 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php @@ -79,9 +79,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidCidrArrayItemForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); // @phpstan-ignore-line @@ -90,7 +90,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'invalid type' => ['not-an-array'], @@ -103,12 +103,16 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array 'empty string' => [['']], // Empty string in array 'whitespace only' => [[' ']], // Whitespace string in array 'malformed CIDR with spaces' => [['192.168.1.0 / 24']], // Space in CIDR notation + 'valid value mixed with null array item' => [['192.168.1.0/24', null]], + 'valid value mixed with integer array item' => [['192.168.1.0/24', 123]], + 'valid value mixed with boolean array item' => [['192.168.1.0/24', true]], + 'valid value mixed with object array item' => [['192.168.1.0/24', new \stdClass()]], ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void { $this->expectException(InvalidCidrArrayItemForPHPException::class); $this->fixture->convertToPHPValue($postgresValue, $this->platform); @@ -117,7 +121,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'invalid format' => ['{"invalid-cidr"}'], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php index c4073c3e..b740c2b4 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php @@ -93,9 +93,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidCidrForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); @@ -104,7 +104,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'empty string' => [''], @@ -124,9 +124,9 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(mixed $dbValue): void + public function throws_exception_for_invalid_php_value_inputs(mixed $dbValue): void { $this->expectException(InvalidCidrForDatabaseException::class); $this->fixture->convertToPHPValue($dbValue, $this->platform); @@ -135,7 +135,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'invalid type' => [123], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php index c82beea2..cd9bafdd 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php @@ -99,9 +99,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidInetArrayItemForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); // @phpstan-ignore-line @@ -110,7 +110,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'invalid type' => ['not-an-array'], @@ -131,9 +131,9 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void { $this->expectException(InvalidInetArrayItemForPHPException::class); @@ -143,7 +143,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'invalid format' => ['{"invalid-ip"}'], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php index 951dfbdc..e4fa2092 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php @@ -101,9 +101,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidInetForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); @@ -112,7 +112,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'non-string value' => [123], @@ -130,12 +130,15 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array 'IPv4 with invalid octet count' => ['192.168.1'], 'IPv4 with character suffix' => ['192.168.1.1x'], 'malformed IPv4-mapped IPv6' => ['::ffff:256.256.256.256'], + 'array input' => [['not', 'ip']], + 'boolean input' => [true], + 'object input' => [new \stdClass()], ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(mixed $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(mixed $postgresValue): void { $this->expectException(InvalidInetForDatabaseException::class); $this->fixture->convertToPHPValue($postgresValue, $this->platform); @@ -144,7 +147,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'non-string value' => [123], @@ -161,6 +164,9 @@ public static function provideInvalidDatabaseValuesForPHPTransformation(): array 'IPv4 with invalid octet count' => ['192.168.1'], 'IPv4 with character suffix' => ['192.168.1.1x'], 'malformed IPv4-mapped IPv6' => ['::ffff:256.256.256.256'], + 'array input' => [['not', 'ip']], + 'boolean input' => [false], + 'object input' => [new \stdClass()], ]; } } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php index bc10d5bc..d81e9c73 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php @@ -5,6 +5,8 @@ namespace Tests\Unit\MartinGeorgiev\Doctrine\DBAL\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Types\ConversionException; +use MartinGeorgiev\Doctrine\DBAL\Types\Exceptions\InvalidJsonItemForPHPException; use MartinGeorgiev\Doctrine\DBAL\Types\Jsonb; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; @@ -48,7 +50,7 @@ public function can_transform_to_php_value(null|array|bool|float|int|string $php } /** - * @return list @@ -56,35 +58,35 @@ public function can_transform_to_php_value(null|array|bool|float|int|string $php public static function provideValidTransformations(): array { return [ - [ + 'null value' => [ 'phpValue' => null, 'postgresValue' => null, ], - [ + 'boolean true' => [ 'phpValue' => true, 'postgresValue' => 'true', ], - [ + 'empty array' => [ 'phpValue' => [], 'postgresValue' => '[]', ], - [ + 'integer value' => [ 'phpValue' => 13, 'postgresValue' => '13', ], - [ + 'float value' => [ 'phpValue' => 13.93, 'postgresValue' => '13.93', ], - [ + 'string value' => [ 'phpValue' => 'a string value', 'postgresValue' => '"a string value"', ], - [ + 'numeric array' => [ 'phpValue' => [681, 1185, 1878, 1989], 'postgresValue' => '[681,1185,1878,1989]', ], - [ + 'complex object' => [ 'phpValue' => [ 'key1' => 'value1', 'key2' => false, @@ -96,4 +98,78 @@ public static function provideValidTransformations(): array ], ]; } + + #[Test] + public function throws_exception_for_non_encodable_value(): void + { + $resourceThatCannotBeJsonEncoded = \fopen('php://memory', 'r'); + + $this->expectException(ConversionException::class); + $this->expectExceptionMessage("can't be resolved to valid JSON"); + + try { + $this->fixture->convertToDatabaseValue($resourceThatCannotBeJsonEncoded, $this->platform); + } finally { + \fclose($resourceThatCannotBeJsonEncoded); + } + } + + #[Test] + public function throws_exception_for_circular_reference(): void + { + // Create a circular reference + $object1 = new \stdClass(); + $object2 = new \stdClass(); + $object1->reference = $object2; + $object2->reference = $object1; + + // Set up a custom error handler to expect the warning + $warningTriggered = false; + \set_error_handler(static function ($error, $errorText) use (&$warningTriggered): bool { + if ($error === E_WARNING && \str_contains($errorText, 'var_export does not handle circular references')) { + $warningTriggered = true; + + return true; // Suppress the circular reference warning + } + + return false; // Let other errors/warnings through + }); + + $this->expectException(ConversionException::class); + $this->expectExceptionMessage("can't be resolved to valid JSON"); + + try { + $this->fixture->convertToDatabaseValue($object1, $this->platform); + } finally { + \restore_error_handler(); + } + + $this->assertTrue($warningTriggered, 'Expected warning about circular references was not triggered'); + } + + #[DataProvider('provideInvalidJsonStrings')] + #[Test] + public function throws_exception_for_invalid_json_strings(string $invalidJson): void + { + $this->expectException(InvalidJsonItemForPHPException::class); + $this->expectExceptionMessage('Postgres value must be single, valid JSON object'); + + $this->fixture->convertToPHPValue($invalidJson, $this->platform); + } + + /** + * @return array + */ + public static function provideInvalidJsonStrings(): array + { + return [ + 'invalid json syntax' => ['{invalid json}'], + 'empty string' => [''], + 'malformed json' => ['{"key": value}'], + 'incomplete json' => ['{"key":'], + 'trailing comma' => ['{"key": "value",}'], + 'unquoted keys' => ['{key: "value"}'], + 'single quotes' => ["{'key': 'value'}"], + ]; + } } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php index 81d104d1..e8f096a3 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php @@ -83,9 +83,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidMacaddrArrayItemForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); // @phpstan-ignore-line @@ -94,7 +94,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'invalid type' => ['not-an-array'], @@ -112,9 +112,9 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void { $this->expectException(InvalidMacaddrArrayItemForPHPException::class); @@ -124,7 +124,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'invalid format' => ['{"invalid-mac"}'], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php index f1c03865..ee83b99e 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php @@ -92,20 +92,22 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidMacaddrForPHPException::class); + $this->fixture->convertToDatabaseValue($phpValue, $this->platform); } /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ + // Invalid MAC address formats 'empty string' => [''], 'invalid format' => ['00:11:22:33:44'], 'invalid characters' => ['00:11:22:gg:hh:ii'], @@ -116,25 +118,58 @@ public static function provideInvalidPHPValuesForDatabaseTransformation(): array 'wrong format' => ['not-a-mac-address'], 'mixed separators' => ['00:11-22:33-44:55'], 'non-hex digits' => ['zz:zz:zz:zz:zz:zz'], + // Invalid types + 'integer input' => [123], + 'array input' => [['not', 'string']], + 'boolean input' => [false], + 'object input' => [new \stdClass()], + 'float input' => [3.14], ]; } - #[DataProvider('provideInvalidDatabaseValuesForPHPTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(mixed $dbValue): void + public function throws_exception_for_invalid_php_value_inputs(mixed $invalidValue): void { $this->expectException(InvalidMacaddrForDatabaseException::class); - $this->fixture->convertToPHPValue($dbValue, $this->platform); + $this->expectExceptionMessage('Database value must be a string'); + + $this->fixture->convertToPHPValue($invalidValue, $this->platform); } /** * @return array */ - public static function provideInvalidDatabaseValuesForPHPTransformation(): array + public static function provideInvalidPHPValueInputs(): array + { + return [ + 'integer input' => [123], + 'array input' => [['not', 'string']], + 'boolean input' => [true], + 'object input' => [new \stdClass()], + 'float input' => [3.14], + ]; + } + + #[DataProvider('provideInvalidPHPValueFormats')] + #[Test] + public function throws_exception_for_invalid_php_value_formats(string $invalidFormat): void + { + $this->expectException(InvalidMacaddrForDatabaseException::class); + $this->expectExceptionMessage('Invalid MAC address format in database'); + + $this->fixture->convertToPHPValue($invalidFormat, $this->platform); + } + + /** + * @return array + */ + public static function provideInvalidPHPValueFormats(): array { return [ - 'invalid type' => [123], 'invalid format from database' => ['invalid-mac-format'], + 'empty string' => [''], + 'malformed mac' => ['00:11:22:33:44'], ]; } } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php index c3b625e2..a0e66fbe 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php @@ -86,9 +86,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidTransformations')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidPointArrayItemForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); // @phpstan-ignore-line @@ -97,7 +97,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidTransformations(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'not an array' => ['string value'], @@ -202,29 +202,34 @@ public function can_transform_array_item_for_php_returning_null_for_null(): void } #[Test] - #[DataProvider('provideInvalidTypes')] + #[DataProvider('provideInvalidPHPValueTypes')] public function can_transform_array_item_for_php_throwing_for_invalid_type(mixed $value): void { $this->expectException(InvalidPointArrayItemForPHPException::class); $this->fixture->transformArrayItemForPHP($value); } + #[DataProvider('provideInvalidPointArrayItems')] #[Test] - #[DataProvider('provideInvalidTypes')] - public function can_transform_postgres_array_to_php_array_returning_empty_for_invalid_format(mixed $value): void + public function throws_exception_for_invalid_point_array_items(array $invalidArray): void { - $reflectionObject = new \ReflectionObject($this->fixture); - $reflectionMethod = $reflectionObject->getMethod('transformPostgresArrayToPHPArray'); - $reflectionMethod->setAccessible(true); - $this->assertSame([], $reflectionMethod->invoke($this->fixture, $value)); + $this->expectException(InvalidPointArrayItemForPHPException::class); + $this->expectExceptionMessage('Array contains invalid point items'); + + $this->fixture->convertToDatabaseValue($invalidArray, $this->platform); } - public static function provideInvalidTypes(): array + /** + * @return array + */ + public static function provideInvalidPointArrayItems(): array { return [ - [123], - ['not-a-point-instance'], - ['{invalid}'], + 'integer item' => [[123]], + 'string item' => [['not-a-point']], + 'boolean item' => [[true]], + 'object item' => [[new \stdClass()]], + 'mixed invalid items' => [[123, 'not-a-point', true]], ]; } } diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php index ef894d94..815b6292 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointTest.php @@ -78,9 +78,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidTransformations')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_database_value(mixed $phpValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $phpValue): void { $this->expectException(InvalidPointForPHPException::class); $this->fixture->convertToDatabaseValue($phpValue, $this->platform); @@ -89,18 +89,22 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_databa /** * @return array */ - public static function provideInvalidTransformations(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ 'empty string' => [''], 'whitespace string' => [' '], 'invalid format' => ['invalid point'], + 'integer input' => [123], + 'array input' => [['not', 'point']], + 'boolean input' => [true], + 'object input' => [new \stdClass()], ]; } - #[DataProvider('provideInvalidDatabaseValues')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(mixed $phpValue): void + public function throws_exception_for_invalid_php_value_inputs(mixed $phpValue): void { $this->expectException(InvalidPointForDatabaseException::class); $this->fixture->convertToPHPValue($phpValue, $this->platform); @@ -109,7 +113,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValues(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'empty string' => [''], @@ -120,6 +124,9 @@ public static function provideInvalidDatabaseValues(): array 'too many coordinates' => ['(1.23,4.56,7.89)'], 'not a string' => [123], 'float precision is too granular' => ['(1.23456789,7.89)'], + 'array input' => [['not', 'point']], + 'boolean input' => [false], + 'object input' => [new \stdClass()], ]; } From 9c7de64b47c3815fd5c02c2398992620490fd0a8 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Sat, 2 Aug 2025 02:11:46 +0300 Subject: [PATCH 10/10] no message --- .../Doctrine/DBAL/Types/BaseFloatArrayTestCase.php | 4 ++-- .../Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php | 4 ++-- .../Doctrine/DBAL/Types/BaseRangeTestCase.php | 4 ++-- .../Doctrine/DBAL/Types/BigIntArrayTest.php | 4 ++-- .../Doctrine/DBAL/Types/DoublePrecisionArrayTest.php | 4 ++-- .../Doctrine/DBAL/Types/IntegerArrayTest.php | 4 ++-- .../MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php | 6 +++--- .../Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php | 5 +++++ .../MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php | 8 ++++---- .../MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php | 4 ++-- .../Doctrine/DBAL/Types/SmallIntArrayTest.php | 4 ++-- 11 files changed, 28 insertions(+), 23 deletions(-) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php index a87e2de2..db135de9 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php @@ -14,7 +14,7 @@ abstract class BaseFloatArrayTestCase extends TestCase { protected BaseFloatArray $fixture; - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void { @@ -24,7 +24,7 @@ public function can_detect_invalid_for_transformation_php_value(mixed $phpValue) /** * @return list */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ [true], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php index bd446324..84fcbe80 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php @@ -14,7 +14,7 @@ abstract class BaseIntegerArrayTestCase extends TestCase { protected BaseIntegerArray $fixture; - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidDatabaseValueInputs')] #[Test] public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void { @@ -24,7 +24,7 @@ public function can_detect_invalid_for_transformation_php_value(mixed $phpValue) /** * @return list */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { return [ [true], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php index f29dfed3..4ffca636 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php @@ -110,7 +110,7 @@ public function can_handle_empty_string_from_sql(): void #[DataProvider('provideInvalidDatabaseValues')] #[Test] - public function throws_exception_when_converting_to_database_value_for_invalid_types(mixed $invalidValue): void + public function throws_exception_for_invalid_database_value_inputs(mixed $invalidValue): void { $this->expectException(InvalidRangeForDatabaseException::class); $this->expectExceptionMessage('Invalid type for range'); @@ -132,7 +132,7 @@ public static function provideInvalidDatabaseValues(): array #[DataProvider('provideInvalidPHPValues')] #[Test] - public function throws_exception_when_converting_to_php_value_for_invalid_types(mixed $invalidValue): void + public function throws_exception_for_invalid_php_value_inputs(mixed $invalidValue): void { $this->expectException(InvalidRangeForPHPException::class); $this->expectExceptionMessage('Invalid database value type for range conversion'); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php index be2ccac8..924a7f2a 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php @@ -22,9 +22,9 @@ public function has_name(): void self::assertEquals('bigint[]', $this->fixture->getName()); } - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { - return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [ + return \array_merge(parent::provideInvalidDatabaseValueInputs(), [ ['9223372036854775808'], // Greater than PHP_INT_MAX ['-9223372036854775809'], // Less than PHP_INT_MIN ['1.23e10'], // Scientific notation diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php index e071fff3..0d6ed3fd 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php @@ -23,9 +23,9 @@ public function has_name(): void self::assertEquals('double precision[]', $this->fixture->getName()); } - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { - return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [ + return \array_merge(parent::provideInvalidDatabaseValueInputs(), [ ['1.7976931348623157E+309'], // Too large ['-1.7976931348623157E+309'], // Too small ['1.123456789012345678'], // Too many decimal places (>15) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php index 7133a4af..f9093ef4 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php @@ -20,9 +20,9 @@ public function has_name(): void self::assertEquals('integer[]', $this->fixture->getName()); } - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { - return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [ + return \array_merge(parent::provideInvalidDatabaseValueInputs(), [ ['2147483648'], // Greater than max integer ['-2147483649'], // Less than min integer ['1.23e6'], // Scientific notation diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php index 9de223d7..11ac3c7c 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php @@ -87,9 +87,9 @@ public static function provideValidTransformations(): array ]; } - #[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void { $this->expectException(InvalidJsonArrayItemForPHPException::class); $this->expectExceptionMessage('Invalid JSON format in array'); @@ -100,7 +100,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'non-array json' => ['"a string encoded as json"'], diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php index d81e9c73..92b4312a 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php @@ -103,11 +103,15 @@ public static function provideValidTransformations(): array public function throws_exception_for_non_encodable_value(): void { $resourceThatCannotBeJsonEncoded = \fopen('php://memory', 'r'); + if ($resourceThatCannotBeJsonEncoded === false) { + $this->fail('Failed to create test resource'); + } $this->expectException(ConversionException::class); $this->expectExceptionMessage("can't be resolved to valid JSON"); try { + // @phpstan-ignore-next-line argument.type - Testing invalid type handling $this->fixture->convertToDatabaseValue($resourceThatCannotBeJsonEncoded, $this->platform); } finally { \fclose($resourceThatCannotBeJsonEncoded); @@ -139,6 +143,7 @@ public function throws_exception_for_circular_reference(): void $this->expectExceptionMessage("can't be resolved to valid JSON"); try { + // @phpstan-ignore-next-line argument.type - Testing invalid type handling $this->fixture->convertToDatabaseValue($object1, $this->platform); } finally { \restore_error_handler(); diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php index a0e66fbe..bab84979 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php @@ -112,9 +112,9 @@ public static function provideInvalidDatabaseValueInputs(): array ]; } - #[DataProvider('provideInvalidDatabaseValues')] + #[DataProvider('provideInvalidPHPValueInputs')] #[Test] - public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void + public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void { $this->expectException(InvalidPointArrayItemForPHPException::class); $this->fixture->convertToPHPValue($postgresValue, $this->platform); @@ -123,7 +123,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va /** * @return array */ - public static function provideInvalidDatabaseValues(): array + public static function provideInvalidPHPValueInputs(): array { return [ 'missing parentheses' => ['{"(1.23, 4.56)","(-7.89, 0.12"}'], @@ -136,7 +136,7 @@ public static function provideInvalidDatabaseValues(): array #[DataProvider('provideInvalidPHPValueTypes')] #[Test] - public function throws_exception_when_non_string_provided_to_convert_to_php_value(mixed $value): void + public function throws_exception_for_non_string_inputs_to_database_conversion(mixed $value): void { $this->expectException(InvalidPointArrayItemForPHPException::class); $this->fixture->convertToDatabaseValue($value, $this->platform); // @phpstan-ignore-line diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php index 63feb5ff..98d13bf0 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php @@ -22,9 +22,9 @@ public function has_name(): void self::assertEquals('real[]', $this->fixture->getName()); } - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { - return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [ + return \array_merge(parent::provideInvalidDatabaseValueInputs(), [ ['3.402823467E+38'], // Too large ['-3.402823467E+38'], // Too small ['1.1234567'], // Too many decimal places (>6) diff --git a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php index f39f693d..5e54b65c 100644 --- a/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php +++ b/tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php @@ -20,9 +20,9 @@ public function has_name(): void self::assertEquals('smallint[]', $this->fixture->getName()); } - public static function provideInvalidPHPValuesForDatabaseTransformation(): array + public static function provideInvalidDatabaseValueInputs(): array { - return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [ + return \array_merge(parent::provideInvalidDatabaseValueInputs(), [ ['32768'], // Greater than max smallint ['-32769'], // Less than min smallint ['1.23e4'], // Scientific notation