Eva\EvaEngine\Interceptor\Dispatch::getCacheBodyKey PHP Method

getCacheBodyKey() public method

public getCacheBodyKey ( ) : string
return string
    public function getCacheBodyKey()
    {
        return $this->cacheBodyKey;
    }

Usage Example

Example #1
0
 public function testJsonpCacheGenerate()
 {
     $_SERVER['HTTP_HOST'] = 'example.com';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['REQUEST_URI'] = '/path?foo=aaa&bar=bbb&callback=testcallback&_=123456';
     $_GET = array('_url' => '/path', 'foo' => 'aaa', 'bar' => 'bbb', 'callback' => 'testcallback', '_' => '123456');
     $request = new Request();
     $this->di->set('request', $request);
     $this->di->getViewCache()->flush();
     $interceptor = new DispatchInterceptor();
     /**
      * @var Dispatcher $dispatcher
     */
     $dispatcher = $this->di->getDispatcher();
     $dispatcher->setParams(array('_dispatch_cache' => 'lifetime=100&format=jsonp'));
     $this->assertEquals(true, $interceptor->injectInterceptor($dispatcher));
     $this->assertEquals($interceptor->getCacheBodyKey(), 'd6bd338ec8eb8666f3d054566f335039_b');
     $this->di->getResponse()->setContent('testcallback({"foo":"bar"});');
     $this->di->getEventsManager()->fire('application:beforeSendResponse', $this->application);
     $this->assertEquals('{"foo":"bar"}', $this->di->getViewCache()->get('d6bd338ec8eb8666f3d054566f335039_b'));
 }