public function __construct(AbstractCacheProviderDecorator $cacheProviderDecorator, Stopwatch $stopwatch) { parent::__construct($cacheProviderDecorator->getCacheProvider(), $cacheProviderDecorator->getDefaultLifetime()); $this->cacheProviderDecorator = $cacheProviderDecorator; $this->cacheCollectedDataBuilder = new CacheCollectedDataBuilder(); self::$stopwatch = $stopwatch; }
/** * {@inheritdoc} */ public function saveWithNamespace($id, $data, $namespaceId = null, $lifeTime = null) { self::$lifeTime = $lifeTime; return parent::saveWithNamespace($id, $data, $namespaceId, $lifeTime); }
/** * @test */ public function call() { /** @var RedisCache $cacheProviderDecorator */ $cacheProviderDecorator = new CacheProviderDecorator(new RedisCache()); $this->assertNull($cacheProviderDecorator->getRedis()); }
/** * @test */ public function WithNamespaceAndParameters_ReturnData() { $data = $this->proxy->cacheWithNamespaceAndParameters(new ParameterClassStub(), 'param 2'); $this->assertEquals(CacheAnnotationClass::DATA, $data); $this->assertEquals(CacheAnnotationClass::DATA, $this->cacheProviderDecorator->fetch($this->cacheProviderDecorator->fetch(md5('test-namespace1')) . md5('OpenClassrooms\\ServiceProxy\\Tests\\Doubles\\CacheAnnotationClass::cacheWithNamespaceAndParameters' . '::' . serialize(new ParameterClassStub()) . '::' . serialize('param 2')))); }