Skip to content

Commit

Permalink
Merge branch 'hotfix/fix-wherehas-nested-query-caching'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed Mar 4, 2018
2 parents 62c4baf + db3046d commit d003028
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Integration/CachedModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ public function testWhereHasIsBeingCached()
$this->assertEquals(1, $cachedResults->first()->author->id);
}

public function testWhereHasWithClosureIsBeingCached()
{
$books1 = (new Book)
->with('author')
->whereHas('author', function ($query) {
$query->whereId(1);
})
->get()
->keyBy('id');
$books2 = (new Book)
->with('author')
->whereHas('author', function ($query) {
$query->whereId(2);
})
->get()
->keyBy('id');

$this->assertNotEmpty($books1->diffKeys($books2));
}

public function testModelCacheDoesntInvalidateDuringCooldownPeriod()
{
$authors = (new Author)
Expand Down

0 comments on commit d003028

Please sign in to comment.