Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ci/phpunit/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
failOnRisky="true"
failOnWarning="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true">
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true">
<testsuites>
<testsuite name="PostgreSQL-for-Doctrine Test Suite">
<directory>../../tests</directory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ public function throws_domain_exception_when_value_exceeds_range(string $outOfRa
/**
* @return array<array{string}>
*/
abstract protected function provideOutOfRangeValues(): array;
abstract public static function provideOutOfRangeValues(): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function throws_domain_exception_when_value_exceeds_range(string $outOfRa
/**
* @return array<array{string}>
*/
protected function provideOutOfRangeValues(): array
public static function provideOutOfRangeValues(): array
{
return [
['9223372036854775808'], // PHP_INT_MAX + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
*
* @dataProvider provideValidTransformations
*/
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue, ?array $platformValue = null): void
{
$this->platform->method('convertFromBoolean')
->with($this->anything())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function provideValidTransformations(): array
/**
* @return array<array{string}>
*/
protected function provideOutOfRangeValues(): array
public static function provideOutOfRangeValues(): array
{
return [
['2147483648'], // MAX_INTEGER + 1
Expand Down
4 changes: 2 additions & 2 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function provideValidTransformations(): array
return [
[
'phpValue' => null,
'postgresJsonb' => null,
'postgresValue' => null,
],
[
'phpValue' => [],
Expand All @@ -85,7 +85,7 @@ public static function provideValidTransformations(): array
'key5' => [304, 404, 504, 604],
],
],
'postgresJsonb' => '{{"key1":"value1","key2":false,"key3":"15","key4":15,"key5":[112,242,309,310]},{"key1":"value2","key2":true,"key3":"115","key4":115,"key5":[304,404,504,604]}}',
'postgresValue' => '{{"key1":"value1","key2":false,"key3":"15","key4":15,"key5":[112,242,309,310]},{"key1":"value2","key2":true,"key3":"115","key4":115,"key5":[304,404,504,604]}}',
],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function provideValidTransformations(): array
/**
* @return array<array{string}>
*/
protected function provideOutOfRangeValues(): array
public static function provideOutOfRangeValues(): array
{
return [
['32768'], // MAX_SMALLINT + 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;

use Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsArrays;
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\InArray;

class InArrayTest extends TestCase
{
protected function getStringFunctions(): array
{
return [
'IN_ARRAY' => InArray::class,
];
}

protected function getExpectedSqlStatements(): array
{
return [
'checks if value is in array' => 'SELECT ? = ANY(c0_.array1) AS sclr_0 FROM ContainsArrays c0_',
];
}

protected function getDqlStatements(): array
{
return [
'checks if value is in array' => \sprintf('SELECT IN_ARRAY(:value, e.array1) FROM %s e', ContainsArrays::class),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Tests\MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;

use Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsTexts;
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RowToJson;

class RowToJsonTest extends TestCase
{
protected function getStringFunctions(): array
{
return [
'ROW_TO_JSON' => RowToJson::class,
];
}

protected function getExpectedSqlStatements(): array
{
return [
'converts row to json' => 'SELECT row_to_json(c0_.text1) AS sclr_0 FROM ContainsTexts c0_',
'converts row with expression to json' => 'SELECT row_to_json(UPPER(c0_.text1)) AS sclr_0 FROM ContainsTexts c0_',
];
}

protected function getDqlStatements(): array
{
return [
'converts row to json' => \sprintf('SELECT ROW_TO_JSON(e.text1) FROM %s e', ContainsTexts::class),
'converts row with expression to json' => \sprintf('SELECT ROW_TO_JSON(UPPER(e.text1)) FROM %s e', ContainsTexts::class),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function throws_invalid_argument_exception_when_tries_to_non_single_dimen
}

/**
* @return array<string, array{phpValue: array, postgresValue: string}>
* @return array<string, array{phpValue: array}>
*/
public static function provideInvalidTransformations(): array
{
Expand All @@ -135,7 +135,6 @@ public static function provideInvalidTransformations(): array
'test',
],
],
'postgresValue' => '',
],
];
}
Expand Down
Loading