Skip to content

Commit 835abab

Browse files
committed
Add unit test for whereNotIn
1 parent a5278f3 commit 835abab

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Unit/CachedBuilderTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,4 +793,24 @@ public function testWhereDatesResults()
793793
$this->assertTrue($cachedResults->diffKeys($books)->isEmpty());
794794
$this->assertTrue($liveResults->diffKeys($books)->isEmpty());
795795
}
796+
797+
public function testWhereNotInResults()
798+
{
799+
$books = (new Book)
800+
->whereNotIn('id', [1, 2])
801+
->get();
802+
$key = sha1('genealabslaravelmodelcachingtestsfixturesbook-id_in_1_2');
803+
$tags = [
804+
'genealabslaravelmodelcachingtestsfixturesbook',
805+
];
806+
807+
$cachedResults = cache()->tags($tags)
808+
->get($key);
809+
$liveResults = (new UncachedAuthor)
810+
->whereNotIn('id', [1, 2])
811+
->get();
812+
813+
$this->assertTrue($cachedResults->diffKeys($books)->isEmpty());
814+
$this->assertTrue($liveResults->diffKeys($books)->isEmpty());
815+
}
796816
}

0 commit comments

Comments
 (0)