public function StreamDecoratorTraitTest::testCatchesExceptionsWhenCastingToString in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php \GuzzleHttp\Tests\Psr7\StreamDecoratorTraitTest::testCatchesExceptionsWhenCastingToString()
File
- vendor/
guzzlehttp/ psr7/ tests/ StreamDecoratorTraitTest.php, line 31
Class
Namespace
GuzzleHttp\Tests\Psr7Code
public function testCatchesExceptionsWhenCastingToString() {
$s = $this
->getMockBuilder('Psr\\Http\\Message\\StreamInterface')
->setMethods([
'read',
])
->getMockForAbstractClass();
$s
->expects($this
->once())
->method('read')
->will($this
->throwException(new \Exception('foo')));
$msg = '';
set_error_handler(function ($errNo, $str) use (&$msg) {
$msg = $str;
});
echo new Str($s);
restore_error_handler();
$this
->assertContains('foo', $msg);
}