You are here

public function ExceptionDataCollectorTest::testCollect in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php \Symfony\Component\HttpKernel\Tests\DataCollector\ExceptionDataCollectorTest::testCollect()

File

vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php, line 21

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());
}