Пример #1
0
    public function testInvalidateTags()
    {
        $cacheInvalidator = new CacheInvalidator($this->getProxyClient());

        $this->assertMiss($this->getResponse('/tags.php'));
        $this->assertHit($this->getResponse('/tags.php'));

        $cacheInvalidator->invalidateTags(array('tag1'))->flush();

        $this->assertMiss($this->getResponse('/tags.php'));
    }
Пример #2
0
 public function testMethodException()
 {
     $proxyClient = \Mockery::mock('\FOS\HttpCache\ProxyClient\ProxyClientInterface');
     $cacheInvalidator = new CacheInvalidator($proxyClient);
     try {
         $cacheInvalidator->invalidatePath('/');
         $this->fail('Expected exception');
     } catch (UnsupportedProxyOperationException $e) {
         // success
     }
     try {
         $cacheInvalidator->refreshPath('/');
         $this->fail('Expected exception');
     } catch (UnsupportedProxyOperationException $e) {
         // success
     }
     try {
         $cacheInvalidator->invalidate(array());
         $this->fail('Expected exception');
     } catch (UnsupportedProxyOperationException $e) {
         // success
     }
     try {
         $cacheInvalidator->invalidateRegex('/');
         $this->fail('Expected exception');
     } catch (UnsupportedProxyOperationException $e) {
         // success
     }
     try {
         $cacheInvalidator->invalidateTags(array());
         $this->fail('Expected exception');
     } catch (UnsupportedProxyOperationException $e) {
         // success
     }
 }