| @@ 11-34 (lines=24) @@ | ||
| 8 | ||
| 9 | class WhereInTest extends IntegrationTestCase |
|
| 10 | { |
|
| 11 | public function testWhereInUsingCollectionQuery() |
|
| 12 | { |
|
| 13 | $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_in_1_2_3_4"); |
|
| 14 | $tags = [ |
|
| 15 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", |
|
| 16 | ]; |
|
| 17 | $authors = (new UncachedAuthor) |
|
| 18 | ->where("id", "<", 5) |
|
| 19 | ->get(["id"]); |
|
| 20 | ||
| 21 | $books = (new Book) |
|
| 22 | ->whereIn("author_id", $authors) |
|
| 23 | ->get(); |
|
| 24 | $cachedResults = $this |
|
| 25 | ->cache() |
|
| 26 | ->tags($tags) |
|
| 27 | ->get($key)['value']; |
|
| 28 | $liveResults = (new UncachedBook) |
|
| 29 | ->whereIn("author_id", $authors) |
|
| 30 | ->get(); |
|
| 31 | ||
| 32 | $this->assertEquals($liveResults->pluck("id"), $books->pluck("id")); |
|
| 33 | $this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id")); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testWhereInWhenSetIsEmpty() |
|
| 37 | { |
|
| @@ 10-33 (lines=24) @@ | ||
| 7 | ||
| 8 | class WhereNotInTest extends IntegrationTestCase |
|
| 9 | { |
|
| 10 | public function testWhereNotInQuery() |
|
| 11 | { |
|
| 12 | $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-author_id_notin_1_2_3_4"); |
|
| 13 | $tags = [ |
|
| 14 | "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", |
|
| 15 | ]; |
|
| 16 | $authors = (new UncachedAuthor) |
|
| 17 | ->where("id", "<", 5) |
|
| 18 | ->get(["id"]); |
|
| 19 | ||
| 20 | $books = (new Book) |
|
| 21 | ->whereNotIn("author_id", $authors) |
|
| 22 | ->get(); |
|
| 23 | $cachedResults = $this |
|
| 24 | ->cache() |
|
| 25 | ->tags($tags) |
|
| 26 | ->get($key)['value']; |
|
| 27 | $liveResults = (new UncachedBook) |
|
| 28 | ->whereNotIn("author_id", $authors) |
|
| 29 | ->get(); |
|
| 30 | ||
| 31 | $this->assertEquals($liveResults->pluck("id"), $books->pluck("id")); |
|
| 32 | $this->assertEquals($liveResults->pluck("id"), $cachedResults->pluck("id")); |
|
| 33 | } |
|
| 34 | ||
| 35 | public function testWhereNotInResults() |
|
| 36 | { |
|