public function ExpectationExceptionTest::testExceptionToString in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink/tests/Exception/ExpectationExceptionTest.php \Behat\Mink\Tests\Exception\ExpectationExceptionTest::testExceptionToString()
File
- vendor/
behat/ mink/ tests/ Exception/ ExpectationExceptionTest.php, line 16
Class
Namespace
Behat\Mink\Tests\ExceptionCode
public function testExceptionToString() {
$driver = $this
->getMock('Behat\\Mink\\Driver\\DriverInterface');
$driver
->expects($this
->any())
->method('getStatusCode')
->will($this
->returnValue(200));
$driver
->expects($this
->any())
->method('getCurrentUrl')
->will($this
->returnValue('http://localhost/test'));
$html = "<html><head><title>Hello</title></head>\n<body>\n<h1>Hello world</h1>\n<p>Test</p>\n</body></html>";
$driver
->expects($this
->any())
->method('getContent')
->will($this
->returnValue($html));
$expected = <<<'TXT'
Expectation failure
+--[ HTTP/1.1 200 | http://localhost/test | %s ]
|
| <body>
| <h1>Hello world</h1>
| <p>Test</p>
| </body>
|
TXT;
$expected = sprintf($expected . ' ', get_class($driver));
$exception = new ExpectationException('Expectation failure', $driver);
$this
->assertEquals($expected, $exception
->__toString());
}