10000 add 子查询Where Exists · APIJSON/hyperf-APIJSON@b1fdfe5 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1fdfe5

Browse files
committed
add 子查询Where Exists
1 parent c9370fd commit b1fdfe5

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

test/Cases/GetTest.php

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GetTest extends TestCase
2323
{
2424
protected string $method = 'GET';
2525

26-
public function testWhereExist()
26+
public function testWhereExists()
2727
{
2828
$json = [
2929
"[]" => [
@@ -229,4 +229,100 @@ public function testWhereInUseSubQuery()
229229
]
230230
], $result);
231231
}
232+
233+
public function testWhereExistsUseSubQuery()
234+
{
235+
$json = [
236+
"subquery@" => [
237+
"from" =>"Comment",
238+
"Comment" => [
239+
"momentId" =>15,
240+
"@column" =>"userId"
241+
]
242+
],
243+
"[]" => [
244+
"User" => [
245+
"id}{@" =>"subquery",
246+
"@column" =>"id,sex,name"
247+
]
248+
]
249+
];
250+
$parse = new Parse($json, $this->method, '');
251+
$result = $parse->handle();
252+
253+
$this->assertSame([
254+
"[]" =>[
255+
[
256+
"User" => [
257+
"id" =>38710,
258+
"sex" =>0,
259+
"name" =>"TommyLemon"
260+
]
261+
],
262+
[
263+
"User" => [
264+
"id" =>70793,
265+
"sex" =>0,
266+
"name" =>"Strong"
267+
]
268+
],
269+
[
270+
"User" => [
271+
"id" =>82001,
272+
"sex" =>0,
273+
"name" =>"测试账号"
274+
]
275+
],
276+
[
277+
"User" => [
278+
"id" =>82002,
279+
"sex" =>1,
280+
"name" =>"Happy~"
281+
]
282+
],
283+
[
284+
"User" => [
285+
"id" =>82003,
286+
"sex" =>0,
287+
"name" =>"Wechat"
288+
]
289+
],
290+
[
291+
"User" => [
292+
"id" =>82004,
293+
"sex" =>0,
294+
"name" =>"Tommy"
295+
]
296+
],
297+
[
298+
"User" => [
299+
"id" =>82005,
300+
"sex" =>1,
301+
"name" =>"Jan"
302+
]
303+
],
304+
[
305+
"User" => [
306+
"id" =>82006,
307+
"sex" =>1,
308+
"name" =>"Meria"
309+
]
310+
],
311+
[
312+
"User" => [
313+
"id" =>82009,
314+
"sex" =>0,
315+
"name" =>"God"
316+
]
317+
],
318+
[
319+
"User" => [
320+
"id" =>82012,
321+
"sex" =>0,
322+
"name" =>"Steve"
323+
]
324+
]
325+
],
326+
], $result);
327+
}
232328
}

0 commit comments

Comments
 (0)
0