/** * Constructor * * @param CacheInvalidator $invalidator The invalidator instance. * @param string $tagsHeader Header to use for tags, defaults to X-Cache-Tags. * * @throws UnsupportedProxyOperationException If CacheInvalidator does not support invalidate requests */ public function __construct(CacheInvalidator $invalidator, $tagsHeader = 'X-Cache-Tags') { if (!$invalidator->supports(CacheInvalidator::INVALIDATE)) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('BAN'); } $this->invalidator = $invalidator; $this->tagsHeader = $tagsHeader; }
/** * @expectedException \InvalidArgumentException */ public function testSupportsInvalid() { $proxyClient = \Mockery::mock('\FOS\HttpCache\ProxyClient\ProxyClientInterface'); $cacheInvalidator = new CacheInvalidator($proxyClient); $cacheInvalidator->supports('garbage'); }