|
4 | 4 | use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Store; |
5 | 5 | use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedBook; |
6 | 6 | use GeneaLabs\LaravelModelCaching\Tests\IntegrationTestCase; |
| 7 | +use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedBookWithCachedStores; |
| 8 | +use GeneaLabs\LaravelModelCaching\Tests\Fixtures\StoreWithUncachedBooks; |
| 9 | +use GeneaLabs\LaravelModelCaching\Tests\Fixtures\BookWithUncachedStores; |
| 10 | +use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedBookWithStores; |
7 | 11 |
|
8 | 12 | class BelongsToManyTest extends IntegrationTestCase |
9 | 13 | { |
@@ -159,4 +163,77 @@ public function testUncachedRelatedModelDoesntCache() |
159 | 163 | $this->assertNotNull($result); |
160 | 164 | $this->assertNotNull($uncachedResult); |
161 | 165 | } |
| 166 | + |
| 167 | + // /** @group test */ |
| 168 | + // public function testUncachedDetachesFromCached() |
| 169 | + // { |
| 170 | + // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); |
| 171 | + // // $tags = [ |
| 172 | + // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", |
| 173 | + // // ]; |
| 174 | + |
| 175 | + // $store = (new StoreWithUncachedBooks) |
| 176 | + // ->with("books") |
| 177 | + // ->has("books") |
| 178 | + // ->first(); |
| 179 | + // $store->books() |
| 180 | + // ->detach(); |
| 181 | + // // $store->delete(); |
| 182 | + // // dd($results); |
| 183 | + // // $cachedResult = $this |
| 184 | + // // ->cache() |
| 185 | + // // ->tags($tags) |
| 186 | + // // ->get($key)['value']; |
| 187 | + |
| 188 | + // // $this->assertNotEmpty($result); |
| 189 | + // // $this->assertNull($cachedResult); |
| 190 | + // } |
| 191 | + |
| 192 | + // /** @group test */ |
| 193 | + // public function testCachedDetachesFromUncached() |
| 194 | + // { |
| 195 | + // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); |
| 196 | + // // $tags = [ |
| 197 | + // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", |
| 198 | + // // ]; |
| 199 | + // $book = (new UncachedBookWithStores) |
| 200 | + // ->with("stores") |
| 201 | + // ->has("stores") |
| 202 | + // ->first(); |
| 203 | + // $book->stores() |
| 204 | + // ->detach(); |
| 205 | + // // $book->delete(); |
| 206 | + // // dd($results); |
| 207 | + // // $cachedResult = $this |
| 208 | + // // ->cache() |
| 209 | + // // ->tags($tags) |
| 210 | + // // ->get($key)['value']; |
| 211 | + |
| 212 | + // // $this->assertNotEmpty($result); |
| 213 | + // // $this->assertNull($cachedResult); |
| 214 | + // } |
| 215 | + |
| 216 | + // public function testDetachingFiresEvent() |
| 217 | + // { |
| 218 | + // // $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}"); |
| 219 | + // // $tags = [ |
| 220 | + // // "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore", |
| 221 | + // // ]; |
| 222 | + |
| 223 | + // $store = (new Store) |
| 224 | + // ->with("books") |
| 225 | + // ->has("books") |
| 226 | + // ->first(); |
| 227 | + // $store->books() |
| 228 | + // ->detach(); |
| 229 | + // $store->delete(); |
| 230 | + // // dd($results); |
| 231 | + // // $cachedResult = $this |
| 232 | + // // ->cache() |
| 233 | + // // ->tags($tags) |
| 234 | + // // ->get($key)['value']; |
| 235 | + |
| 236 | + // // $this->assertNotEmpty($result); |
| 237 | + // // $this->assertNull($cachedResult); |
| 238 | + // } |
162 | 239 | } |
0 commit comments