Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
96
vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php
vendored
Normal file
96
vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Selector;
|
||||
|
||||
use Behat\Mink\Selector\SelectorsHandler;
|
||||
|
||||
class SelectorsHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testRegisterSelector()
|
||||
{
|
||||
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
|
||||
$handler = new SelectorsHandler();
|
||||
|
||||
$this->assertFalse($handler->isSelectorRegistered('custom'));
|
||||
|
||||
$handler->registerSelector('custom', $selector);
|
||||
|
||||
$this->assertTrue($handler->isSelectorRegistered('custom'));
|
||||
$this->assertSame($selector, $handler->getSelector('custom'));
|
||||
}
|
||||
|
||||
public function testRegisterSelectorThroughConstructor()
|
||||
{
|
||||
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
|
||||
$handler = new SelectorsHandler(array('custom' => $selector));
|
||||
|
||||
$this->assertTrue($handler->isSelectorRegistered('custom'));
|
||||
$this->assertSame($selector, $handler->getSelector('custom'));
|
||||
}
|
||||
|
||||
public function testRegisterDefaultSelectors()
|
||||
{
|
||||
$handler = new SelectorsHandler();
|
||||
|
||||
$this->assertTrue($handler->isSelectorRegistered('css'));
|
||||
$this->assertTrue($handler->isSelectorRegistered('named_exact'));
|
||||
$this->assertTrue($handler->isSelectorRegistered('named_partial'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testXpathSelectorThrowsExceptionForArrayLocator()
|
||||
{
|
||||
$handler = new SelectorsHandler();
|
||||
$handler->selectorToXpath('xpath', array('some_xpath'));
|
||||
}
|
||||
|
||||
public function testXpathSelectorIsReturnedAsIs()
|
||||
{
|
||||
$handler = new SelectorsHandler();
|
||||
$this->assertEquals('some_xpath', $handler->selectorToXpath('xpath', 'some_xpath'));
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testXpathLiteral()
|
||||
{
|
||||
$handler = new SelectorsHandler();
|
||||
|
||||
$this->assertEquals("'some simple string'", $handler->xpathLiteral('some simple string'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testBcLayer()
|
||||
{
|
||||
$selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock();
|
||||
$handler = new SelectorsHandler();
|
||||
|
||||
$handler->registerSelector('named_partial', $selector);
|
||||
|
||||
$this->assertSame($selector, $handler->getSelector('named'));
|
||||
}
|
||||
}
|
Reference in a new issue