Ejemplo n.º 1
0
 /**
  * @test
  */
 public function it_adds_gifs_in_twig_global_variables()
 {
     $kernel = new \Joli\GifExceptionBundle\Tests\app\AppKernel('dev', true);
     $kernel->boot();
     /** @var \Twig_Environment $twig */
     $twig = $kernel->getContainer()->get('twig');
     $globals = $twig->getGlobals();
     self::assertArrayHasKey('fail_gifs', $globals);
     self::assertNotEmpty($globals['fail_gifs']);
 }
Ejemplo n.º 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('/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'));
 }