Skip to content

Commit ecef5d1

Browse files
chore: improve tests by adding more SQL scenarios and adding descriptions to the tested query variations
1 parent a873d10 commit ecef5d1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonArrayLengthTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ protected function getStringFunctions(): array
1919
protected function getExpectedSqlStatements(): array
2020
{
2121
return [
22-
'SELECT json_array_length(c0_.object1) AS sclr_0 FROM ContainsJsons c0_',
22+
'gets length of top-level array' => 'SELECT json_array_length(c0_.object1) AS sclr_0 FROM ContainsJsons c0_',
23+
'gets length from literal json' => "SELECT json_array_length('{\"iso_3166_a3_code\":\"BGR\"}') AS sclr_0 FROM ContainsJsons c0_",
2324
];
2425
}
2526

2627
protected function getDqlStatements(): array
2728
{
2829
return [
29-
\sprintf('SELECT JSON_ARRAY_LENGTH(e.object1) FROM %s e', ContainsJsons::class),
30+
'gets length of top-level array' => \sprintf('SELECT JSON_ARRAY_LENGTH(e.object1) FROM %s e', ContainsJsons::class),
31+
'gets length from literal json' => \sprintf("SELECT JSON_ARRAY_LENGTH('{\"iso_3166_a3_code\":\"BGR\"}') FROM %s e", ContainsJsons::class),
3032
];
3133
}
3234
}

0 commit comments

Comments
 (0)