You are here

public function SelectorsHandlerTest::testSelectorToXpath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php \Behat\Mink\Tests\Selector\SelectorsHandlerTest::testSelectorToXpath()

File

vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php, line 55

Class

SelectorsHandlerTest

Namespace

Behat\Mink\Tests\Selector

Code

public function testSelectorToXpath() {
  $selector = $this
    ->getMockBuilder('Behat\\Mink\\Selector\\SelectorInterface')
    ->getMock();
  $handler = new SelectorsHandler();
  $handler
    ->registerSelector('custom_selector', $selector);
  $selector
    ->expects($this
    ->once())
    ->method('translateToXPath')
    ->with($locator = 'some[locator]')
    ->will($this
    ->returnValue($ret = '[]some[]locator'));
  $this
    ->assertEquals($ret, $handler
    ->selectorToXpath('custom_selector', $locator));
  $this
    ->setExpectedException('InvalidArgumentException');
  $handler
    ->selectorToXpath('undefined', 'asd');
}