engelsystem/tests/Unit/Exceptions/Handlers/LegacyDevelopmentTest.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.0 KiB
PHP
Raw Normal View History

2017-11-24 15:08:43 +01:00
<?php
namespace Engelsystem\Test\Unit\Exceptions\Handlers;
2017-11-24 15:08:43 +01:00
use Engelsystem\Exceptions\Handlers\LegacyDevelopment;
use Engelsystem\Http\Request;
use ErrorException;
use PHPUnit\Framework\MockObject\MockObject;
2017-11-24 15:08:43 +01:00
use PHPUnit\Framework\TestCase;
class LegacyDevelopmentTest extends TestCase
{
/**
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace()
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render()
2017-11-24 15:08:43 +01:00
*/
public function testRender(): void
{
$handler = new LegacyDevelopment();
/** @var Request|MockObject $request */
2017-11-24 15:08:43 +01:00
$request = $this->createMock(Request::class);
2020-04-05 19:32:55 +02:00
$exception = new ErrorException('Lorem <b>Ipsum</b>', 4242, 1, 'foo.php', 9999);
2017-11-24 15:08:43 +01:00
$regex = sprintf(
2020-04-05 19:32:55 +02:00
'%%<pre.*>.*ErrorException.*4242.*Lorem &lt;b&gt;Ipsum&lt;/b&gt;.*%s.*%s.*%s.*</pre>%%is',
2017-11-24 15:08:43 +01:00
'foo.php',
9999,
__FUNCTION__
);
$this->expectOutputRegex($regex);
$handler->render($request, $exception);
}
}