Skip to content

Commit 3145d7e

Browse files
committed
Added test for unsupported "WebDriver::status" handling
1 parent 4c5da8e commit 3145d7e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/Custom/WebDriverTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace Behat\Mink\Tests\Driver\Custom;
44

55
use Behat\Mink\Driver\Selenium2Driver;
6+
use Behat\Mink\Exception\DriverException;
67
use Behat\Mink\Tests\Driver\TestCase;
8+
use WebDriver\WebDriver;
79

810
class WebDriverTest extends TestCase
911
{
@@ -18,4 +20,21 @@ public function testGetWebDriverSessionId()
1820
$driver = new Selenium2Driver();
1921
$this->assertNull($driver->getWebDriverSessionId(), 'Not started session don\'t have an ID');
2022
}
23+
24+
public function testUnsupportedStatusResponseHandling(): void
25+
{
26+
$mockWebDriver = $this->createMock(WebDriver::class);
27+
$mockWebDriver->expects($this->once())
28+
->method('__call')
29+
->with($this->equalTo('status'))
30+
->willThrowException(new \RuntimeException('some internal error'));
31+
32+
$driver = new Selenium2Driver();
33+
$driver->setWebDriver($mockWebDriver);
34+
35+
$this->expectException(DriverException::class);
36+
$this->expectExceptionMessage('Selenium Server version could not be detected: some internal error');
37+
38+
$driver->start();
39+
}
2140
}

0 commit comments

Comments
 (0)