/**
  * @covers ::sendResponse
  */
 public function testSendingResponse()
 {
     $willSendResponseCalled = false;
     $this->application->getContainer()->get('event_manager')->subscribe(WillSendResponse::getName(), function () use(&$willSendResponseCalled) {
         $willSendResponseCalled = true;
     });
     $request = Request::create('/');
     $response = new Response('This is some valid response.');
     ob_start();
     $this->application->sendResponse($response, $request);
     $content = ob_get_contents();
     ob_end_clean();
     $this->assertEquals('This is some valid response.', $content);
     $this->assertTrue($willSendResponseCalled);
 }
示例#2
0
 /**
  * @covers \Splot\Framework\Events\WillSendResponse::__construct
  * @covers \Splot\Framework\Events\WillSendResponse::getRequest
  * @covers \Splot\Framework\Events\WillSendResponse::getResponse
  */
 public function testWillSendResponse()
 {
     $request = Request::create('/test/');
     $response = new Response('some response');
     $event = new Events\WillSendResponse($response, $request);
     $this->assertSame($request, $event->getRequest());
     $this->assertSame($response, $event->getResponse());
 }