Eva\EvaEngine\EvaEngineTest\Interceptor\DispatchTest::testJsonpCacheHit PHP Method

testJsonpCacheHit() public method

public testJsonpCacheHit ( )
    public function testJsonpCacheHit()
    {
        $_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();
        $this->di->getViewCache()->save('d6bd338ec8eb8666f3d054566f335039_b', '{"foo":"bar"}');
        $this->di->getViewCache()->save('d6bd338ec8eb8666f3d054566f335039_h', '{"Content-Type":"application\\/json;+charset=utf-8","X-EvaEngine-Interceptor-Cache":"2014-12-09T06:45:42+0100"}');
        $interceptor = new DispatchInterceptor();
        /**
         * @var Dispatcher $dispatcher
        */
        $dispatcher = $this->di->getDispatcher();
        $dispatcher->setParams(array('_dispatch_cache' => 'lifetime=100&format=jsonp'));
        $this->assertEquals(false, $interceptor->injectInterceptor($dispatcher));
        $this->assertEquals('testcallback({"foo":"bar"})', $this->di->getResponse()->getContent());
    }