public function testEnablingRaiseThrowablesFlagWillCauseInvocationToRaiseMiddlewareExceptionForStringArgument()
{
$next = new Next($this->queue, $this->prophesize(DelegateInterface::class)->reveal());
$next->raiseThrowables();
$triggered = false;
$this->errorHandler = set_error_handler(function ($errno, $errstr) use(&$triggered) {
$this->assertContains('error middleware is deprecated', $errstr);
$triggered = true;
return true;
}, E_USER_DEPRECATED);
try {
$next($this->request, $this->response, 'Throwable');
$this->fail('Throwable not raised when it was expected');
} catch (Exception\MiddlewareException $e) {
$this->assertEquals('Throwable', $e->getMessage());
} catch (\Throwable $e) {
$this->fail(sprintf('Caught unexpected throwable: %s', $e->getMessage()));
} catch (\Exception $e) {
$this->fail(sprintf('Caught unexpected exception: %s', $e->getMessage()));
}
$this->assertTrue($triggered, 'Deprecation notice not triggered');
}