Skip to content

Commit 82be9a1

Browse files
authored
Merge pull request #328 from dmason30/fix-json-contains-test
Fix json contains test running on empty dataset
2 parents 3e7a70c + dd8485d commit 82be9a1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/Integration/CachedBuilder/WhereJsonContainsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function setUp() : void
2525
parent::setUp();
2626

2727
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
28+
factory(Author::class, 10)->create();
2829
}
2930

3031
public function testWithInUsingCollectionQuery()
@@ -37,6 +38,7 @@ public function testWithInUsingCollectionQuery()
3738
$authors = (new Author)
3839
->whereJsonContains("finances->total", 5000)
3940
->get();
41+
4042
$liveResults = (new UncachedAuthor)
4143
->whereJsonContains("finances->total", 5000)
4244
->get();
@@ -46,6 +48,8 @@ public function testWithInUsingCollectionQuery()
4648
->tags($tags)
4749
->get($key)['value'];
4850

51+
$this->assertCount(10, $cachedResults);
52+
$this->assertCount(10, $liveResults);
4953
$this->assertEquals($liveResults->pluck("id"), $authors->pluck("id"));
5054
$this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id"));
5155
}
@@ -69,6 +73,8 @@ public function testWithInUsingCollectionQueryWithArrayValues()
6973
->tags($tags)
7074
->get($key)['value'];
7175

76+
$this->assertCount(10, $liveResults);
77+
$this->assertCount(10, $cachedResults);
7278
$this->assertEquals($liveResults->pluck("id"), $authors->pluck("id"));
7379
$this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id"));
7480
}

0 commit comments

Comments
 (0)