コード例 #1
0
 public function testDispatchAndInvokeAreTheSame()
 {
     $request = (new ServerRequest())->withAttribute('template', 'foo.html.twig');
     $firstResp = $this->template->dispatch($request, new Response());
     $this->assertEquals('<h1>Hello!!</h1>', $firstResp->getBody()->__toString());
     $this->assertEquals(200, $firstResp->getStatusCode());
     $secondResp = $this->template->__invoke($request, new Response());
     $this->assertEquals('<h1>Hello!!</h1>', $secondResp->getBody()->__toString());
     $this->assertEquals(200, $secondResp->getStatusCode());
 }
コード例 #2
0
 public function __construct(TemplateInterface $renderer, ContactServiceInterface $contactService, ContactFilter $contactFilter, \ArrayAccess $session = null)
 {
     parent::__construct($renderer);
     $this->contactService = $contactService;
     $this->contactFilter = $contactFilter;
     $this->container = $session ?: new Container(__CLASS__);
 }