コード例 #1
0
 /**
  * @test
  */
 public function it_displays_gif_on_exception_page_if_the_bundle_is_enabled()
 {
     $kernel = new \Joli\GifExceptionBundle\Tests\app\AppKernel('dev', true);
     $kernel->boot();
     $request = Request::create('/error-404');
     $response = $kernel->handle($request);
     self::assertSame(404, $response->getStatusCode());
     $image = $this->getImage($response->getContent());
     self::assertTrue($image->hasAttribute('data-gif'));
     self::assertStringMatchesFormat('%s/gifexception/images/404/%s.gif', $image->getAttribute('src'));
     $request = Request::create('/error-418');
     $response = $kernel->handle($request);
     self::assertSame(418, $response->getStatusCode());
     $image = $this->getImage($response->getContent());
     self::assertTrue($image->hasAttribute('data-gif'));
     self::assertStringMatchesFormat('%s/gifexception/images/other/%s.gif', $image->getAttribute('src'));
 }
コード例 #2
0
 /**
  * @test
  */
 public function it_displays_gif_on_exception_page_if_the_bundle_is_enabled()
 {
     $kernel = new \Joli\GifExceptionBundle\Tests\app\AppKernel('dev', true);
     $kernel->boot();
     $request = Request::create('/');
     $response = $kernel->handle($request);
     self::assertSame(404, $response->getStatusCode());
     self::assertNotFalse(strpos($response->getContent(), '<img alt="Gif Exception"'));
 }