diff --git a/tests/Exception/ExpectationExceptionTest.php b/tests/Exception/ExpectationExceptionTest.php
index 23e53bc77..466bcca63 100644
--- a/tests/Exception/ExpectationExceptionTest.php
+++ b/tests/Exception/ExpectationExceptionTest.php
@@ -56,6 +56,48 @@ public function testExceptionToString()
$this->assertEquals($expected, $exception->__toString());
}
+ public function testBigContent()
+ {
+ $driver = $this->getMock('Behat\Mink\Driver\DriverInterface');
+ $page = $this->getPageMock();
+
+ $session = $this->getSessionMock();
+ $session->expects($this->any())
+ ->method('getDriver')
+ ->will($this->returnValue($driver));
+ $session->expects($this->any())
+ ->method('getPage')
+ ->will($this->returnValue($page));
+ $session->expects($this->any())
+ ->method('getStatusCode')
+ ->will($this->returnValue(200));
+ $session->expects($this->any())
+ ->method('getCurrentUrl')
+ ->will($this->returnValue('http://localhost/test'));
+
+ $body = str_repeat('a', 1001 - strlen('
'));
+
+ $html = sprintf("Hello\n%s", $body);
+ $page->expects($this->any())
+ ->method('getContent')
+ ->will($this->returnValue($html));
+
+ $expected = <<<'TXT'
+Expectation failure
+
++--[ HTTP/1.1 200 | http://localhost/test | %s ]
+|
+| %sassertEquals($expected, $exception->__toString());
+ }
+
public function testExceptionWhileRenderingString()
{
$session = $this->getSessionMock();
diff --git a/tests/Selector/SelectorsHandlerTest.php b/tests/Selector/SelectorsHandlerTest.php
index 8bcb37997..a20d3d9db 100644
--- a/tests/Selector/SelectorsHandlerTest.php
+++ b/tests/Selector/SelectorsHandlerTest.php
@@ -77,4 +77,16 @@ public function testXpathLiteral()
$this->assertEquals("'some simple string'", $handler->xpathLiteral('some simple string'));
}
+
+ public function testBcLayer()
+ {
+ $selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
+ $handler = new SelectorsHandler();
+
+ $handler->registerSelector('named_partial', $selector);
+
+ $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
+
+ $this->assertSame($selector, $handler->getSelector('named'));
+ }
}
diff --git a/tests/SessionTest.php b/tests/SessionTest.php
index b000ba69b..9e6796db9 100644
--- a/tests/SessionTest.php
+++ b/tests/SessionTest.php
@@ -21,9 +21,9 @@ class SessionTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->driver = $this->getMockBuilder('Behat\Mink\Driver\DriverInterface')->getMock();
+ $this->driver = $this->getMockBuilder('Behat\Mink\Driver\DriverInterface')->getMock();
$this->selectorsHandler = $this->getMockBuilder('Behat\Mink\Selector\SelectorsHandler')->getMock();
- $this->session = new Session($this->driver, $this->selectorsHandler);
+ $this->session = new Session($this->driver, $this->selectorsHandler);
}
public function testGetDriver()
@@ -41,6 +41,13 @@ public function testGetSelectorsHandler()
$this->assertSame($this->selectorsHandler, $this->session->getSelectorsHandler());
}
+ public function testInstantiateWithoutOptionalDeps()
+ {
+ $session = new Session($this->driver);
+
+ $this->assertInstanceOf('Behat\Mink\Selector\SelectorsHandler', $session->getSelectorsHandler());
+ }
+
public function testIsStarted()
{
$this->driver->expects($this->once())