You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/Unit/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonBuildObjectTest.php
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,9 @@ protected function getExpectedSqlStatements(): array
30
30
'builds JSON object with field value' => "SELECT json_build_object('key1', c0_.object1) AS sclr_0 FROM ContainsJsons c0_",
31
31
'builds JSON object with function result and literal' => "SELECT json_build_object('key1', UPPER('value1'), 'key2', 'value2') AS sclr_0 FROM ContainsJsons c0_",
32
32
'builds JSON object with multiple field values' => "SELECT json_build_object('key1', c0_.object1, 'key2', c0_.object2) AS sclr_0 FROM ContainsJsons c0_",
33
+
'builds JSON object with many key-value pairs' => "SELECT json_build_object('k1', 'v1', 'k2', 'v2', 'k3', 'v3', 'k4', 'v4') AS sclr_0 FROM ContainsJsons c0_",
34
+
'builds JSON object with numeric and boolean values' => "SELECT json_build_object('numeric_key', '123', 'boolean_key', 'true') AS sclr_0 FROM ContainsJsons c0_",
35
+
'builds JSON object with mixed field and literal values' => "SELECT json_build_object('field_key', c0_.object1, 'literal_key', 'literal_value') AS sclr_0 FROM ContainsJsons c0_",
33
36
];
34
37
}
35
38
@@ -39,15 +42,29 @@ protected function getDqlStatements(): array
39
42
'builds JSON object with field value' => \sprintf("SELECT JSON_BUILD_OBJECT('key1', e.object1) FROM %s e", ContainsJsons::class),
40
43
'builds JSON object with function result and literal' => \sprintf("SELECT JSON_BUILD_OBJECT('key1', UPPER('value1'), 'key2', 'value2') FROM %s e", ContainsJsons::class),
41
44
'builds JSON object with multiple field values' => \sprintf("SELECT JSON_BUILD_OBJECT('key1', e.object1, 'key2', e.object2) FROM %s e", ContainsJsons::class),
45
+
'builds JSON object with many key-value pairs' => \sprintf("SELECT JSON_BUILD_OBJECT('k1', 'v1', 'k2', 'v2', 'k3', 'v3', 'k4', 'v4') FROM %s e", ContainsJsons::class),
46
+
'builds JSON object with numeric and boolean values' => \sprintf("SELECT JSON_BUILD_OBJECT('numeric_key', '123', 'boolean_key', 'true') FROM %s e", ContainsJsons::class),
47
+
'builds JSON object with mixed field and literal values' => \sprintf("SELECT JSON_BUILD_OBJECT('field_key', e.object1, 'literal_key', 'literal_value') FROM %s e", ContainsJsons::class),
"SELECT jsonb_build_object('key1', c0_.object1) AS sclr_0 FROM ContainsJsons c0_",
31
-
"SELECT jsonb_build_object('key1', UPPER('value1'), 'key2', 'value2') AS sclr_0 FROM ContainsJsons c0_",
32
-
"SELECT jsonb_build_object('key1', c0_.object1, 'key2', c0_.object2) AS sclr_0 FROM ContainsJsons c0_",
30
+
'builds JSONB object with field value' => "SELECT jsonb_build_object('key1', c0_.object1) AS sclr_0 FROM ContainsJsons c0_",
31
+
'builds JSONB object with function result and literal' => "SELECT jsonb_build_object('key1', UPPER('value1'), 'key2', 'value2') AS sclr_0 FROM ContainsJsons c0_",
32
+
'builds JSONB object with multiple field values' => "SELECT jsonb_build_object('key1', c0_.object1, 'key2', c0_.object2) AS sclr_0 FROM ContainsJsons c0_",
33
+
'builds JSONB object with many key-value pairs' => "SELECT jsonb_build_object('k1', 'v1', 'k2', 'v2', 'k3', 'v3', 'k4', 'v4') AS sclr_0 FROM ContainsJsons c0_",
34
+
'builds JSONB object with numeric and boolean values' => "SELECT jsonb_build_object('numeric_key', '123', 'boolean_key', 'true') AS sclr_0 FROM ContainsJsons c0_",
35
+
'builds JSONB object with mixed field and literal values' => "SELECT jsonb_build_object('field_key', c0_.object1, 'literal_key', 'literal_value') AS sclr_0 FROM ContainsJsons c0_",
33
36
];
34
37
}
35
38
36
39
protectedfunctiongetDqlStatements(): array
37
40
{
38
41
return [
39
-
\sprintf("SELECT JSONB_BUILD_OBJECT('key1', e.object1) FROM %s e", ContainsJsons::class),
40
-
\sprintf("SELECT JSONB_BUILD_OBJECT('key1', UPPER('value1'), 'key2', 'value2') FROM %s e", ContainsJsons::class),
41
-
\sprintf("SELECT JSONB_BUILD_OBJECT('key1', e.object1, 'key2', e.object2) FROM %s e", ContainsJsons::class),
42
+
'builds JSONB object with field value' => \sprintf("SELECT JSONB_BUILD_OBJECT('key1', e.object1) FROM %s e", ContainsJsons::class),
43
+
'builds JSONB object with function result and literal' => \sprintf("SELECT JSONB_BUILD_OBJECT('key1', UPPER('value1'), 'key2', 'value2') FROM %s e", ContainsJsons::class),
44
+
'builds JSONB object with multiple field values' => \sprintf("SELECT JSONB_BUILD_OBJECT('key1', e.object1, 'key2', e.object2) FROM %s e", ContainsJsons::class),
45
+
'builds JSONB object with many key-value pairs' => \sprintf("SELECT JSONB_BUILD_OBJECT('k1', 'v1', 'k2', 'v2', 'k3', 'v3', 'k4', 'v4') FROM %s e", ContainsJsons::class),
46
+
'builds JSONB object with numeric and boolean values' => \sprintf("SELECT JSONB_BUILD_OBJECT('numeric_key', '123', 'boolean_key', 'true') FROM %s e", ContainsJsons::class),
47
+
'builds JSONB object with mixed field and literal values' => \sprintf("SELECT JSONB_BUILD_OBJECT('field_key', e.object1, 'literal_key', 'literal_value') FROM %s e", ContainsJsons::class),
0 commit comments