* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ExceptionDataCollectorTest extends TestCase { 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()); } public function testCollectWithoutException() { $c = new ExceptionDataCollector(); $c->collect(new Request(), new Response()); $this->assertFalse($c->hasException()); } public function testReset() { $c = new ExceptionDataCollector(); $c->collect(new Request(), new Response(), new \Exception()); $c->reset(); $c->collect(new Request(), new Response()); $this->assertFalse($c->hasException()); } } __halt_compiler();----SIGNATURE:----clQ+GclfwR11CTYPBrxw/i6/H48w3Tz/2WtXXsNlkoJbff+a4TZ5HlHweaX7G3Aagcmk3DPCf+46Jpl2PeAKGo1M5RGE5K7blQzo7vjoYqdb8DpDgvtRIzo/jPJY6F/h7cIW0zQqs2Mfa8d6hOEUoKWHYkc5lfspBGXt5golQah7jy5bDUgOcJ2TyVQp0MLJX9yA+PDbpRvl/MpDD0Q28F5C9eXOVtoiZdOeFsTjVD1cUCbAlhOp8YqPCsuJ1zh29KDQsrFbDlMLBVZTzf0QEJ0b0GmJyHene1ZqczRfH62jVff3aDXbGj3dzUWq1zZ14FdB5wxsVxAy216HPzlXhozGjH/1kmEpzJJ3wJm7oD016zdTMGUXUPFz8SpcA7JgoVOr+AXWAwWLBpwrvz7KjP319L7WtQqRNn8eYes45JCXUV4zDDLHV6IFyOfyCgDO1/OVOhy9Xhu1XaxOnp94chJvUhqZHoGVjeM8kNsYdfCwXyHQHWwJ31U50dy6GzW+N58wt/EYj2M0+DsYYifBmnKFV3S5rBj/JQUKgCAxF21eBVvytdgk2IWi+dG6l3u2p9Cslw88x6hdk9yG1xDf44kU7EJPzYY+Wz180oT/9JXhl3whv6xVuK/j/8TXy5eNl/I+b8D5J425ybn37OoD2XGC64sP21/pE7bGAOgocKc=----ATTACHMENT:----MTEzMjYxMzQ1MjYwNjM3MCAxNzAxNzc0OTA4NTM4NjI5IDUxNTIwODg2NTk0ODA3MzM=