示例#1
0
 public function testResult()
 {
     $kernel = new MockEndpointKernel();
     $kernel->setCubex($this->getCubex());
     $result = $kernel->handle(Request::create('/result', 'GET', []));
     $this->assertContains('json', $result->headers->get('content-type'));
     $this->assertEquals('{"status":{"code":200,"message":""},' . '"type":"\\CubexTest\\Cubex\\Kernel\\MockEndpointResult"' . ',"result":{"name":"Test"}}', stripcslashes($result->getContent()));
 }
示例#2
0
 public function testFavicon()
 {
     $request = Request::create('/favicon.ico');
     $cubex = $this->sampleProjectCubex();
     $cubex->configure(new TestConfigProvider());
     $resp = $cubex->handle($request);
     $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\BinaryFileResponse', $resp);
 }
示例#3
0
 /**
  * Retrieve a response from the project
  *
  * @param        $uri
  * @param string $method
  * @param array  $parameters
  *
  * @return TestResponse
  * @throws \Exception
  */
 public function getResponse($uri, $method = 'GET', $parameters = [])
 {
     $request = Request::create($uri, $method, $parameters);
     $this->setLastResponse(new TestResponse($this->getCubex()->handle($request)));
     return $this->getLastResponse();
 }