use Symfony\Component\HttpKernel\HttpKernelInterface;
class ErrorControllerTest extends TestCase
{ /**
* @dataProvider getInvokeControllerDataProvider
*/
public function testInvokeController(Request
$request, \Exception
$exception, int
$statusCode, string
$content) { $kernel =
$this->
createMock(HttpKernelInterface::
class);
$errorRenderer =
new HtmlErrorRenderer();
$controller =
new ErrorController($kernel, null,
$errorRenderer);
$response =
$controller($exception);
$this->
assertSame($statusCode,
$response->
getStatusCode());
self::
assertStringContainsString($content,
strtr($response->
getContent(),
["\n" => '', ' ' => ''
]));
} public static function getInvokeControllerDataProvider() { yield 'default status code and HTML format' =>
[ new Request(),
new \
Exception(),