File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
src/Symfony/Component/Cache Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 20
20
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
21
21
* @author Nicolas Grekas <p@tchwork.com>
22
22
*/
23
- class TraceableAdapter implements AdapterInterface
23
+ class TraceableAdapter implements TagAwareAdapterInterface
24
24
{
25
25
private $ pool ;
26
26
private $ calls = array ();
@@ -168,6 +168,19 @@ public function commit()
168
168
}
169
169
}
170
170
171
+ /**
172
+ * {@inheritdoc}
173
+ */
174
+ public function invalidateTags (array $ tags )
175
+ {
176
+ $ event = $ this ->start (__FUNCTION__ , $ tags );
177
+ try {
178
+ return $ event ->result = $ this ->pool ->invalidateTags ($ tags );
179
+ } finally {
180
+ $ event ->end = microtime (true );
181
+ }
182
+ }
183
+
171
184
public function getCalls ()
172
185
{
173
186
try {
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Cache \Tests \Adapter ;
13
13
14
14
use Symfony \Component \Cache \Adapter \FilesystemAdapter ;
15
+ use Symfony \Component \Cache \Adapter \TagAwareAdapter ;
15
16
use Symfony \Component \Cache \Adapter \TraceableAdapter ;
16
17
17
18
/**
@@ -184,4 +185,20 @@ public function testCommitTrace()
184
185
$ this ->assertNotEmpty ($ call ->start );
185
186
$ this ->assertNotEmpty ($ call ->end );
186
187
}
188
+
189
+ public function testInvalidateTags ()
190
+ {
191
+ $ pool = new TraceableAdapter (new TagAwareAdapter (new FilesystemAdapter ()));
192
+ $ pool ->invalidateTags (array ('foo ' ));
193
+ $ calls = $ pool ->getCalls ();
194
+ $ this ->assertCount (1 , $ calls );
195
+
196
+ $ call = $ calls [0 ];
197
+ $ this ->assertSame ('invalidateTags ' , $ call ->name );
198
+ $ this ->assertSame (array ('foo ' ), $ call ->argument );
199
+ $ this ->assertSame (0 , $ call ->hits );
200
+ $ this ->assertSame (0 , $ call ->misses );
201
+ $ this ->assertNotEmpty ($ call ->start );
202
+ $ this ->assertNotEmpty ($ call ->end );
203
+ }
187
204
}
You can’t perform that action at this time.
0 commit comments