Skip to content

Commit e615e53

Browse files
author
Fiete Börner
committed
change testSubdocumentArrayAggregate
change test for different scenarios
1 parent 039458d commit e615e53

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/QueryBuilderTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,17 @@ public function testSubdocumentAggregate()
422422
public function testSubdocumentArrayAggregate()
423423
{
424424
DB::collection('items')->insert([
425-
['name' => 'knife', 'amount' => [['hidden' => 10, 'found' => 3]]],
426-
['name' => 'fork', 'amount' => [['hidden' => 35, 'found' => 12]]],
425+
['name' => 'knife', 'amount' => [['hidden' => 10, 'found' => 3],['hidden' => 5, 'found' => 2]]],
426+
['name' => 'fork', 'amount' => [['hidden' => 35, 'found' => 12],['hidden' => 7, 'found' => 17],['hidden' => 1, 'found' => 19]]],
427427
['name' => 'spoon', 'amount' => [['hidden' => 14, 'found' => 21]]],
428-
['name' => 'spoon', 'amount' => [['hidden' => 6, 'found' => 4]]],
428+
['name' => 'teaspoon', 'amount' => []],
429429
]);
430430

431-
$this->assertEquals(65, DB::collection('items')->sum('amount.*.hidden'));
432-
$this->assertEquals(4, DB::collection('items')->count('amount.*.hidden'));
433-
$this->assertEquals(6, DB::collection('items')->min('amount.*.hidden'));
431+
$this->assertEquals(72, DB::collection('items')->sum('amount.*.hidden'));
432+
$this->assertEquals(6, DB::collection('items')->count('amount.*.hidden'));
433+
$this->assertEquals(1, DB::collection('items')->min('amount.*.hidden'));
434434
$this->assertEquals(35, DB::collection('items')->max('amount.*.hidden'));
435-
$this->assertEquals(16.25, DB::collection('items')->avg('amount.*.hidden'));
435+
$this->assertEquals(12, DB::collection('items')->avg('amount.*.hidden'));
436436
}
437437

438438
public function testUpsert()

0 commit comments

Comments
 (0)