|
@@ 93-108 (lines=16) @@
|
| 90 |
|
$this->assertNull($results); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public function testHasManyRelationshipIsCached() |
| 94 |
|
{ |
| 95 |
|
$authors = (new Author)->with('books')->get(); |
| 96 |
|
|
| 97 |
|
$results = collect($this->cache()->tags([ |
| 98 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", |
| 99 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook" |
| 100 |
|
]) |
| 101 |
|
->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:books"))['value']); |
| 102 |
|
|
| 103 |
|
$this->assertNotNull($results); |
| 104 |
|
$this->assertEmpty($authors->diffKeys($results)); |
| 105 |
|
$this->assertNotEmpty($authors); |
| 106 |
|
$this->assertNotEmpty($results); |
| 107 |
|
$this->assertEquals($authors->count(), $results->count()); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
public function testBelongsToRelationshipIsCached() |
| 111 |
|
{ |
|
@@ 110-125 (lines=16) @@
|
| 107 |
|
$this->assertEquals($authors->count(), $results->count()); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
public function testBelongsToRelationshipIsCached() |
| 111 |
|
{ |
| 112 |
|
$books = (new Book)->with('author')->get(); |
| 113 |
|
|
| 114 |
|
$results = collect($this->cache()->tags([ |
| 115 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", |
| 116 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor" |
| 117 |
|
]) |
| 118 |
|
->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:author"))['value']); |
| 119 |
|
|
| 120 |
|
$this->assertNotNull($results); |
| 121 |
|
$this->assertEmpty($books->diffKeys($results)); |
| 122 |
|
$this->assertNotEmpty($books); |
| 123 |
|
$this->assertNotEmpty($results); |
| 124 |
|
$this->assertEquals($books->count(), $results->count()); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
public function testBelongsToManyRelationshipIsCached() |
| 128 |
|
{ |
|
@@ 127-142 (lines=16) @@
|
| 124 |
|
$this->assertEquals($books->count(), $results->count()); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
public function testBelongsToManyRelationshipIsCached() |
| 128 |
|
{ |
| 129 |
|
$books = (new Book)->with('stores')->get(); |
| 130 |
|
|
| 131 |
|
$results = collect($this->cache()->tags([ |
| 132 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook", |
| 133 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore" |
| 134 |
|
]) |
| 135 |
|
->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-testing:{$this->testingSqlitePath}testing.sqlite:stores"))['value']); |
| 136 |
|
|
| 137 |
|
$this->assertNotNull($results); |
| 138 |
|
$this->assertEmpty($books->diffKeys($results)); |
| 139 |
|
$this->assertNotEmpty($books); |
| 140 |
|
$this->assertNotEmpty($results); |
| 141 |
|
$this->assertEquals($books->count(), $results->count()); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
public function testHasOneRelationshipIsCached() |
| 145 |
|
{ |
|
@@ 144-160 (lines=17) @@
|
| 141 |
|
$this->assertEquals($books->count(), $results->count()); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
public function testHasOneRelationshipIsCached() |
| 145 |
|
{ |
| 146 |
|
$authors = (new Author)->with('profile')->get(); |
| 147 |
|
|
| 148 |
|
$results = collect($this->cache() |
| 149 |
|
->tags([ |
| 150 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor", |
| 151 |
|
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesprofile" |
| 152 |
|
]) |
| 153 |
|
->get(sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null-testing:{$this->testingSqlitePath}testing.sqlite:profile"))['value']); |
| 154 |
|
|
| 155 |
|
$this->assertNotNull($results); |
| 156 |
|
$this->assertEmpty($authors->diffKeys($results)); |
| 157 |
|
$this->assertNotEmpty($authors); |
| 158 |
|
$this->assertNotEmpty($results); |
| 159 |
|
$this->assertEquals($authors->count(), $results->count()); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
public function testAvgModelResultsCreatesCache() |
| 163 |
|
{ |