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

38 lines
1.1 KiB
PHP
Raw Normal View History

2017-11-24 15:08:43 +01:00
<?php
declare(strict_types=1);
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
{
/**
2022-12-22 00:08:54 +01:00
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::formatStackTrace
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::render
* @covers \Engelsystem\Exceptions\Handlers\LegacyDevelopment::getDisplayNameOfValue
2017-11-24 15:08:43 +01:00
*/
public function testRender(): void
2017-11-24 15:08:43 +01:00
{
$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);
}
}