Skip to content

Commit 5b4f975

Browse files
chore: test functions against a real PostgreSQL server (#381)
1 parent d83a099 commit 5b4f975

31 files changed

+474
-92
lines changed

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayAppendTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_append_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$actual = $this->transformPostgresArray($result[0]['result']);
2524
$this->assertIsArray($actual);
2625
$this->assertSame(['apple', 'banana', 'orange', 'orange'], $actual);
@@ -33,7 +32,6 @@ public function test_array_append_with_integer_array(): void
3332
WHERE t.id = 1';
3433

3534
$result = $this->executeDqlQuery($dql);
36-
$this->assertIsString($result[0]['result']);
3735
$actual = $this->transformPostgresArray($result[0]['result']);
3836
$this->assertIsArray($actual);
3937
$this->assertSame([1, 2, 3, 3], $actual);
@@ -46,7 +44,6 @@ public function test_array_append_with_boolean_array(): void
4644
WHERE t.id = 1';
4745

4846
$result = $this->executeDqlQuery($dql);
49-
$this->assertIsString($result[0]['result']);
5047
$actual = $this->transformPostgresArray($result[0]['result']);
5148
$this->assertIsArray($actual);
5249
$this->assertSame([true, false, true, true], $actual);

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayCardinalityTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_cardinality_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsInt($result[0]['result']);
2423
$this->assertSame(3, $result[0]['result']);
2524
}
2625

@@ -31,7 +30,6 @@ public function test_array_cardinality_with_integer_array(): void
3130
WHERE t.id = 1';
3231

3332
$result = $this->executeDqlQuery($dql);
34-
$this->assertIsInt($result[0]['result']);
3533
$this->assertSame(3, $result[0]['result']);
3634
}
3735

@@ -42,7 +40,6 @@ public function test_array_cardinality_with_boolean_array(): void
4240
WHERE t.id = 1';
4341

4442
$result = $this->executeDqlQuery($dql);
45-
$this->assertIsInt($result[0]['result']);
4643
$this->assertSame(3, $result[0]['result']);
4744
}
4845
}

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayDimensionsTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_dimensions_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$this->assertSame('[1:3]', $result[0]['result']);
2524
}
2625

@@ -31,7 +30,6 @@ public function test_array_dimensions_with_integer_array(): void
3130
WHERE t.id = 1';
3231

3332
$result = $this->executeDqlQuery($dql);
34-
$this->assertIsString($result[0]['result']);
3533
$this->assertSame('[1:3]', $result[0]['result']);
3634
}
3735

@@ -42,7 +40,6 @@ public function test_array_dimensions_with_boolean_array(): void
4240
WHERE t.id = 1';
4341

4442
$result = $this->executeDqlQuery($dql);
45-
$this->assertIsString($result[0]['result']);
4643
$this->assertSame('[1:3]', $result[0]['result']);
4744
}
4845
}

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayPrependTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_prepend_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$actual = $this->transformPostgresArray($result[0]['result']);
2524
$this->assertIsArray($actual);
2625
$this->assertSame(['orange', 'apple', 'banana', 'orange'], $actual);
@@ -33,7 +32,6 @@ public function test_array_prepend_with_integer_array(): void
3332
WHERE t.id = 1';
3433

3534
$result = $this->executeDqlQuery($dql);
36-
$this->assertIsString($result[0]['result']);
3735
$actual = $this->transformPostgresArray($result[0]['result']);
3836
$this->assertIsArray($actual);
3937
$this->assertSame([3, 1, 2, 3], $actual);
@@ -46,7 +44,6 @@ public function test_array_prepend_with_boolean_array(): void
4644
WHERE t.id = 1';
4745

4846
$result = $this->executeDqlQuery($dql);
49-
$this->assertIsString($result[0]['result']);
5047
$actual = $this->transformPostgresArray($result[0]['result']);
5148
$this->assertIsArray($actual);
5249
$this->assertSame([true, true, false, true], $actual);

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayRemoveTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_remove_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$actual = $this->transformPostgresArray($result[0]['result']);
2524
$this->assertIsArray($actual);
2625
$this->assertSame(['apple', 'orange'], $actual);
@@ -33,7 +32,6 @@ public function test_array_remove_with_integer_array(): void
3332
WHERE t.id = 1';
3433

3534
$result = $this->executeDqlQuery($dql);
36-
$this->assertIsString($result[0]['result']);
3735
$actual = $this->transformPostgresArray($result[0]['result']);
3836
$this->assertIsArray($actual);
3937
$this->assertSame([1, 3], $actual);
@@ -46,7 +44,6 @@ public function test_array_remove_with_boolean_array(): void
4644
WHERE t.id = 1';
4745

4846
$result = $this->executeDqlQuery($dql);
49-
$this->assertIsString($result[0]['result']);
5047
$actual = $this->transformPostgresArray($result[0]['result']);
5148
$this->assertIsArray($actual);
5249
$this->assertSame([true, true], $actual);
@@ -59,7 +56,6 @@ public function test_array_remove_with_not_found_element(): void
5956
WHERE t.id = 1';
6057

6158
$result = $this->executeDqlQuery($dql);
62-
$this->assertIsString($result[0]['result']);
6359
$actual = $this->transformPostgresArray($result[0]['result']);
6460
$this->assertIsArray($actual);
6561
$this->assertSame(['apple', 'banana', 'orange'], $actual);

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayReplaceTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_replace_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$actual = $this->transformPostgresArray($result[0]['result']);
2524
$this->assertIsArray($actual);
2625
$this->assertSame(['apple', 'mango', 'orange'], $actual);
@@ -33,7 +32,6 @@ public function test_array_replace_with_integer_array(): void
3332
WHERE t.id = 1';
3433

3534
$result = $this->executeDqlQuery($dql);
36-
$this->assertIsString($result[0]['result']);
3735
$actual = $this->transformPostgresArray($result[0]['result']);
3836
$this->assertIsArray($actual);
3937
$this->assertSame([1, 5, 3], $actual);
@@ -46,7 +44,6 @@ public function test_array_replace_with_boolean_array(): void
4644
WHERE t.id = 1';
4745

4846
$result = $this->executeDqlQuery($dql);
49-
$this->assertIsString($result[0]['result']);
5047
$actual = $this->transformPostgresArray($result[0]['result']);
5148
$this->assertIsArray($actual);
5249
$this->assertSame([true, true, true], $actual);
@@ -59,7 +56,6 @@ public function test_array_replace_with_not_found_element(): void
5956
WHERE t.id = 1';
6057

6158
$result = $this->executeDqlQuery($dql);
62-
$this->assertIsString($result[0]['result']);
6359
$actual = $this->transformPostgresArray($result[0]['result']);
6460
$this->assertIsArray($actual);
6561
$this->assertSame(['apple', 'banana', 'orange'], $actual);

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToJsonTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function test_array_to_json_with_text_array(): void
2020
WHERE t.id = 1';
2121

2222
$result = $this->executeDqlQuery($dql);
23-
$this->assertIsString($result[0]['result']);
2423
$this->assertSame('["apple","banana","orange"]', $result[0]['result']);
2524
}
2625

@@ -31,7 +30,6 @@ public function test_array_to_json_with_integer_array(): void
3130
WHERE t.id = 1';
3231

3332
$result = $this->executeDqlQuery($dql);
34-
$this->assertIsString($result[0]['result']);
3533
$this->assertSame('[1,2,3]', $result[0]['result']);
3634
}
3735

@@ -42,7 +40,6 @@ public function test_array_to_json_with_boolean_array(): void
4240
WHERE t.id = 1';
4341

4442
$result = $this->executeDqlQuery($dql);
45-
$this->assertIsString($result[0]['result']);
4643
$this->assertSame('[true,false,true]', $result[0]['result']);
4744
}
4845
}

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrayToStringTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function test_array_to_string_with_default_delimiter(): void
1919
FROM Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsArrays t
2020
WHERE t.id = 1';
2121
$result = $this->executeDqlQuery($dql);
22-
$this->assertIsString($result[0]['result']);
2322
$this->assertSame('apple,banana,orange', $result[0]['result']);
2423
}
2524

@@ -29,7 +28,6 @@ public function test_array_to_string_with_custom_delimiter(): void
2928
FROM Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsArrays t
3029
WHERE t.id = 1';
3130
$result = $this->executeDqlQuery($dql);
32-
$this->assertIsString($result[0]['result']);
3331
$this->assertSame('apple | banana | orange', $result[0]['result']);
3432
}
3533
}

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DateExtractTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function test_date_extract_with_year(): void
1919
FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t
2020
WHERE t.id = 1";
2121
$result = $this->executeDqlQuery($dql);
22-
$this->assertIsString($result[0]['result']);
2322
$this->assertSame('2023', $result[0]['result']);
2423
}
2524

@@ -29,7 +28,6 @@ public function test_date_extract_with_month(): void
2928
FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t
3029
WHERE t.id = 1";
3130
$result = $this->executeDqlQuery($dql);
32-
$this->assertIsString($result[0]['result']);
3331
$this->assertSame('6', $result[0]['result']);
3432
}
3533

@@ -39,7 +37,6 @@ public function test_date_extract_with_day(): void
3937
FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t
4038
WHERE t.id = 1";
4139
$result = $this->executeDqlQuery($dql);
42-
$this->assertIsString($result[0]['result']);
4340
$this->assertSame('15', $result[0]['result']);
4441
}
4542

@@ -49,7 +46,6 @@ public function test_date_extract_with_column_reference(): void
4946
FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t
5047
WHERE t.id = 1";
5148
$result = $this->executeDqlQuery($dql);
52-
$this->assertIsString($result[0]['result']);
5349
$this->assertSame('2023', $result[0]['result']);
5450
}
5551
}

tests/Integration/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/DaterangeTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,13 @@ public function test_daterange(): void
1919
{
2020
$dql = 'SELECT DATERANGE(t.date1, t.date2) as result FROM Fixtures\MartinGeorgiev\Doctrine\Entity\ContainsDates t WHERE t.id = 1';
2121
$result = $this->executeDqlQuery($dql);
22-
$this->assertIsArray($result);
23-
$this->assertNotEmpty($result[0]['result']);
24-
$this->assertIsString($result[0]['result']);
2522
$this->assertSame('[2023-06-15,2023-06-16)', $result[0]['result']);
2623
}
2724

2825
public function test_daterange_with_bounds(): void
2926
{
30-
$dql = "SELECT DATERANGE(t.date1, t.date2, '[)') as result FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t WHERE t.id = 1";
27+
$dql = "SELECT DATERANGE(t.date1, t.date2, '(]') as result FROM Fixtures\\MartinGeorgiev\\Doctrine\\Entity\\ContainsDates t WHERE t.id = 1";
3128
$result = $this->executeDqlQuery($dql);
32-
$this->assertIsArray($result);
33-
$this->assertNotEmpty($result[0]['result']);
34-
$this->assertIsString($result[0]['result']);
35-
$this->assertSame('[2023-06-15,2023-06-16)', $result[0]['result']);
29+
$this->assertSame('[2023-06-16,2023-06-17)', $result[0]['result']);
3630
}
3731
}

0 commit comments

Comments
 (0)