@@ -73,20 +73,47 @@ public function testForget()
7373 $ this ->assertNull ($ this ->cache (['cache ' ])->get ());
7474 }
7575
76- public function testFlush ()
76+ public function testFlushByKeys ()
7777 {
78- $ tags = Cache::make ()->tags ('foo ' , ' bar ' );
79- $ cache = ( clone $ tags )->key ('qwerty ' );
78+ $ cache1 = Cache::make ()->key ('foo ' );
79+ $ cache2 = Cache:: make ( )->key ('bar ' );
8080
81- $ this ->assertNull ($ cache ->get ());
81+ $ this ->assertNull ($ cache1 ->get ());
82+ $ this ->assertNull ($ cache2 ->get ());
8283
83- $ cache ->put ('asd ' );
84+ $ cache1 ->put ('qwe ' );
85+ $ cache2 ->put ('rty ' );
8486
85- $ this ->assertSame ('asd ' , $ cache ->get ());
87+ $ this ->assertSame ('qwe ' , $ cache1 ->get ());
88+ $ this ->assertSame ('rty ' , $ cache2 ->get ());
8689
87- $ tags ->flush ();
90+ $ cache1 ->flush ();
8891
89- $ this ->assertNull ($ cache ->get ());
92+ $ this ->assertNull ($ cache1 ->get ());
93+ $ this ->assertNull ($ cache2 ->get ());
94+ }
95+
96+ public function testFlushByTags ()
97+ {
98+ $ tags1 = Cache::make ()->tags ('some1 ' );
99+ $ tags2 = Cache::make ()->tags ('some2 ' );
100+
101+ $ cache1 = (clone $ tags1 )->key ('foo ' );
102+ $ cache2 = (clone $ tags2 )->key ('bar ' );
103+
104+ $ this ->assertNull ($ cache1 ->get ());
105+ $ this ->assertNull ($ cache2 ->get ());
106+
107+ $ cache1 ->put ('qwe ' );
108+ $ cache2 ->put ('rty ' );
109+
110+ $ this ->assertSame ('qwe ' , $ cache1 ->get ());
111+ $ this ->assertSame ('rty ' , $ cache2 ->get ());
112+
113+ $ tags1 ->flush ();
114+
115+ $ this ->assertNull ($ cache1 ->get ());
116+ $ this ->assertSame ('rty ' , $ cache2 ->get ());
90117 }
91118
92119 public function testHas ()
0 commit comments