Açıklama Yok

ExceptionDataCollectorTest.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Tests\DataCollector;
  11. use Symfony\Component\Debug\Exception\FlattenException;
  12. use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\HttpFoundation\Response;
  15. class ExceptionDataCollectorTest extends \PHPUnit_Framework_TestCase
  16. {
  17. public function testCollect()
  18. {
  19. $e = new \Exception('foo', 500);
  20. $c = new ExceptionDataCollector();
  21. $flattened = FlattenException::create($e);
  22. $trace = $flattened->getTrace();
  23. $this->assertFalse($c->hasException());
  24. $c->collect(new Request(), new Response(), $e);
  25. $this->assertTrue($c->hasException());
  26. $this->assertEquals($flattened, $c->getException());
  27. $this->assertSame('foo', $c->getMessage());
  28. $this->assertSame(500, $c->getCode());
  29. $this->assertSame('exception', $c->getName());
  30. $this->assertSame($trace, $c->getTrace());
  31. }
  32. }