Skip to content

Commit 9c7de64

Browse files
no message
1 parent ed9319c commit 9c7de64

File tree

11 files changed

+28
-23
lines changed

11 files changed

+28
-23
lines changed

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class BaseFloatArrayTestCase extends TestCase
1414
{
1515
protected BaseFloatArray $fixture;
1616

17-
#[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')]
17+
#[DataProvider('provideInvalidDatabaseValueInputs')]
1818
#[Test]
1919
public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void
2020
{
@@ -24,7 +24,7 @@ public function can_detect_invalid_for_transformation_php_value(mixed $phpValue)
2424
/**
2525
* @return list<mixed>
2626
*/
27-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
27+
public static function provideInvalidDatabaseValueInputs(): array
2828
{
2929
return [
3030
[true],

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class BaseIntegerArrayTestCase extends TestCase
1414
{
1515
protected BaseIntegerArray $fixture;
1616

17-
#[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')]
17+
#[DataProvider('provideInvalidDatabaseValueInputs')]
1818
#[Test]
1919
public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void
2020
{
@@ -24,7 +24,7 @@ public function can_detect_invalid_for_transformation_php_value(mixed $phpValue)
2424
/**
2525
* @return list<mixed>
2626
*/
27-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
27+
public static function provideInvalidDatabaseValueInputs(): array
2828
{
2929
return [
3030
[true],

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseRangeTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function can_handle_empty_string_from_sql(): void
110110

111111
#[DataProvider('provideInvalidDatabaseValues')]
112112
#[Test]
113-
public function throws_exception_when_converting_to_database_value_for_invalid_types(mixed $invalidValue): void
113+
public function throws_exception_for_invalid_database_value_inputs(mixed $invalidValue): void
114114
{
115115
$this->expectException(InvalidRangeForDatabaseException::class);
116116
$this->expectExceptionMessage('Invalid type for range');
@@ -132,7 +132,7 @@ public static function provideInvalidDatabaseValues(): array
132132

133133
#[DataProvider('provideInvalidPHPValues')]
134134
#[Test]
135-
public function throws_exception_when_converting_to_php_value_for_invalid_types(mixed $invalidValue): void
135+
public function throws_exception_for_invalid_php_value_inputs(mixed $invalidValue): void
136136
{
137137
$this->expectException(InvalidRangeForPHPException::class);
138138
$this->expectExceptionMessage('Invalid database value type for range conversion');

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function has_name(): void
2222
self::assertEquals('bigint[]', $this->fixture->getName());
2323
}
2424

25-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
25+
public static function provideInvalidDatabaseValueInputs(): array
2626
{
27-
return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [
27+
return \array_merge(parent::provideInvalidDatabaseValueInputs(), [
2828
['9223372036854775808'], // Greater than PHP_INT_MAX
2929
['-9223372036854775809'], // Less than PHP_INT_MIN
3030
['1.23e10'], // Scientific notation

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public function has_name(): void
2323
self::assertEquals('double precision[]', $this->fixture->getName());
2424
}
2525

26-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
26+
public static function provideInvalidDatabaseValueInputs(): array
2727
{
28-
return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [
28+
return \array_merge(parent::provideInvalidDatabaseValueInputs(), [
2929
['1.7976931348623157E+309'], // Too large
3030
['-1.7976931348623157E+309'], // Too small
3131
['1.123456789012345678'], // Too many decimal places (>15)

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public function has_name(): void
2020
self::assertEquals('integer[]', $this->fixture->getName());
2121
}
2222

23-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
23+
public static function provideInvalidDatabaseValueInputs(): array
2424
{
25-
return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [
25+
return \array_merge(parent::provideInvalidDatabaseValueInputs(), [
2626
['2147483648'], // Greater than max integer
2727
['-2147483649'], // Less than min integer
2828
['1.23e6'], // Scientific notation

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public static function provideValidTransformations(): array
8787
];
8888
}
8989

90-
#[DataProvider('provideInvalidPHPValuesForDatabaseTransformation')]
90+
#[DataProvider('provideInvalidPHPValueInputs')]
9191
#[Test]
92-
public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void
92+
public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void
9393
{
9494
$this->expectException(InvalidJsonArrayItemForPHPException::class);
9595
$this->expectExceptionMessage('Invalid JSON format in array');
@@ -100,7 +100,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va
100100
/**
101101
* @return array<string, array{string}>
102102
*/
103-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
103+
public static function provideInvalidPHPValueInputs(): array
104104
{
105105
return [
106106
'non-array json' => ['"a string encoded as json"'],

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ public static function provideValidTransformations(): array
103103
public function throws_exception_for_non_encodable_value(): void
104104
{
105105
$resourceThatCannotBeJsonEncoded = \fopen('php://memory', 'r');
106+
if ($resourceThatCannotBeJsonEncoded === false) {
107+
$this->fail('Failed to create test resource');
108+
}
106109

107110
$this->expectException(ConversionException::class);
108111
$this->expectExceptionMessage("can't be resolved to valid JSON");
109112

110113
try {
114+
// @phpstan-ignore-next-line argument.type - Testing invalid type handling
111115
$this->fixture->convertToDatabaseValue($resourceThatCannotBeJsonEncoded, $this->platform);
112116
} finally {
113117
\fclose($resourceThatCannotBeJsonEncoded);
@@ -139,6 +143,7 @@ public function throws_exception_for_circular_reference(): void
139143
$this->expectExceptionMessage("can't be resolved to valid JSON");
140144

141145
try {
146+
// @phpstan-ignore-next-line argument.type - Testing invalid type handling
142147
$this->fixture->convertToDatabaseValue($object1, $this->platform);
143148
} finally {
144149
\restore_error_handler();

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/PointArrayTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public static function provideInvalidDatabaseValueInputs(): array
112112
];
113113
}
114114

115-
#[DataProvider('provideInvalidDatabaseValues')]
115+
#[DataProvider('provideInvalidPHPValueInputs')]
116116
#[Test]
117-
public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void
117+
public function throws_exception_for_invalid_php_value_inputs(string $postgresValue): void
118118
{
119119
$this->expectException(InvalidPointArrayItemForPHPException::class);
120120
$this->fixture->convertToPHPValue($postgresValue, $this->platform);
@@ -123,7 +123,7 @@ public function throws_exception_when_invalid_data_provided_to_convert_to_php_va
123123
/**
124124
* @return array<string, array{string}>
125125
*/
126-
public static function provideInvalidDatabaseValues(): array
126+
public static function provideInvalidPHPValueInputs(): array
127127
{
128128
return [
129129
'missing parentheses' => ['{"(1.23, 4.56)","(-7.89, 0.12"}'],
@@ -136,7 +136,7 @@ public static function provideInvalidDatabaseValues(): array
136136

137137
#[DataProvider('provideInvalidPHPValueTypes')]
138138
#[Test]
139-
public function throws_exception_when_non_string_provided_to_convert_to_php_value(mixed $value): void
139+
public function throws_exception_for_non_string_inputs_to_database_conversion(mixed $value): void
140140
{
141141
$this->expectException(InvalidPointArrayItemForPHPException::class);
142142
$this->fixture->convertToDatabaseValue($value, $this->platform); // @phpstan-ignore-line

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function has_name(): void
2222
self::assertEquals('real[]', $this->fixture->getName());
2323
}
2424

25-
public static function provideInvalidPHPValuesForDatabaseTransformation(): array
25+
public static function provideInvalidDatabaseValueInputs(): array
2626
{
27-
return \array_merge(parent::provideInvalidPHPValuesForDatabaseTransformation(), [
27+
return \array_merge(parent::provideInvalidDatabaseValueInputs(), [
2828
['3.402823467E+38'], // Too large
2929
['-3.402823467E+38'], // Too small
3030
['1.1234567'], // Too many decimal places (>6)

0 commit comments

Comments
 (0)