/**
  * @return ProxyStrategyResponse
  */
 public function preExecute(ProxyStrategyRequest $proxyStrategyRequest)
 {
     /** @var CacheProxyStrategyRequest $proxyStrategyRequest */
     $this->data = $this->cache->fetchWithNamespace($proxyStrategyRequest->getId(), $proxyStrategyRequest->getNamespaceId());
     if ($this->responseIsInCache()) {
         $stopExecution = true;
         $this->postExecute = false;
     } else {
         $stopExecution = false;
     }
     $response = new ProxyStrategyResponseDTO($this->data, $stopExecution);
     return $response;
 }
Beispiel #2
0
 /**
  * @test
  */
 public function WithNamespaceId_FetchWithNamespace_ReturnData()
 {
     $this->cacheProviderSpy->cacheProvider->save(self::NAMESPACE_ID, self::NAMESPACE_ID_VALUE);
     $this->cacheProviderSpy->cacheProvider->save(self::NAMESPACE_ID_VALUE . self::ID, self::NAMESPACE_DATA);
     $data = $this->cache->fetchWithNamespace(self::ID, self::NAMESPACE_ID);
     $this->assertEquals(CacheProviderSpy::NAMESPACE_DATA, $data);
     $this->assertTrue($this->cacheProviderSpy->fetchHasBeenCalled);
     $this->assertEquals(self::NAMESPACE_ID_VALUE . self::ID, $this->cacheProviderSpy->id);
 }