public function ExceptionDataCollectorTest::testCollect

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php, line 28

Class

ExceptionDataCollectorTest

Namespace

Symfony\Component\HttpKernel\Tests\DataCollector

Code

public function testCollect() {
  $e = new \Exception('foo', 500);
  $c = new ExceptionDataCollector();
  $flattened = FlattenException::create($e);
  $trace = $flattened
    ->getTrace();
  $this
    ->assertFalse($c
    ->hasException());
  $c
    ->collect(new Request(), new Response(), $e);
  $this
    ->assertTrue($c
    ->hasException());
  $this
    ->assertEquals($flattened, $c
    ->getException());
  $this
    ->assertSame('foo', $c
    ->getMessage());
  $this
    ->assertSame(500, $c
    ->getCode());
  $this
    ->assertSame('exception', $c
    ->getName());
  $this
    ->assertSame($trace, $c
    ->getTrace());
}