File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1919 "mockery/mockery" : " 0.9.*" ,
2020 "phpmd/phpmd" : " ^2.6" ,
2121 "phpunit/phpunit" : " 5.7.*" ,
22- "satooshi/php-coveralls" : " dev-master@dev " ,
22+ "satooshi/php-coveralls" : " * " ,
2323 "sebastian/phpcpd" : " *"
2424 },
2525 "autoload" : {
Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ public function cursor()
3131 });
3232 }
3333
34+ public function delete ()
35+ {
36+ $ this ->cache ($ this ->makeCacheTags ())
37+ ->flush ();
38+
39+ return parent ::delete ();
40+ }
41+
3442 /**
3543 * @SuppressWarnings(PHPMD.ShortVariable)
3644 */
Original file line number Diff line number Diff line change @@ -660,4 +660,27 @@ public function testRawOrderByWithoutColumnReference()
660660 $ this ->assertTrue ($ cachedResults ->diffAssoc ($ authors )->isEmpty ());
661661 $ this ->assertTrue ($ liveResults ->diffAssoc ($ authors )->isEmpty ());
662662 }
663+
664+ public function testDelete ()
665+ {
666+ $ author = (new Author )
667+ ->first ();
668+ $ liveResult = (new UncachedAuthor )
669+ ->first ();
670+ $ authorId = $ author ->id ;
671+ $ liveResultId = $ liveResult ->id ;
672+ $ key = 'genealabslaravelmodelcachingtestsfixturesauthor ' ;
673+ $ tags = ['genealabslaravelmodelcachingtestsfixturesauthor ' ];
674+
675+ $ author ->delete ();
676+ $ liveResult ->delete ();
677+ $ cachedResult = cache ()
678+ ->tags ($ tags )
679+ ->get ($ key );
680+ $ deletedAuthor = (new Author )->find ($ authorId );
681+
682+ $ this ->assertEquals ($ liveResultId , $ authorId );
683+ $ this ->assertNull ($ cachedResult );
684+ $ this ->assertNull ($ deletedAuthor );
685+ }
663686}
You can’t perform that action at this time.
0 commit comments