/** * @test */ function it_does_not_save_empty_result_to_cache() { $this->pool->expects($this->never())->method('save'); $annotation = new CacheUpdate(['pools' => 'pool', 'tags' => 'tag', 'ttl' => 300]); $interception = new ProxyInterceptionSuffix(new \stdClass(), 'method', ['key1' => 'value1'], null); $result = $this->interceptor->interceptSuffix($annotation, $interception); $this->assertInstanceOf(EmptyResult::class, $result); }
/** * @test */ function it_removes_a_cache_tags_on_inctercept_suffix() { $this->pool->method('hasItem')->with('key')->willReturn(true); $this->pool->expects($this->once())->method('clearTags')->with(['tag1', 'tag2']); $annotation = new CacheEvict(['pools' => 'pool', 'tags' => 'tag1, tag2']); $interception = new ProxyInterceptionSuffix(new \stdClass(), 'method', ['key1' => 'value1'], 'returnValue'); $result = $this->interceptor->interceptSuffix($annotation, $interception); $this->assertInstanceOf(EvictResult::class, $result); }