abstract class ElementTest in Zircon Profile 8
Same name in this branch
- 8 vendor/behat/mink/tests/Element/ElementTest.php \Behat\Mink\Tests\Element\ElementTest
- 8 core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest
- 8 core/modules/system/src/Tests/Form/ElementTest.php \Drupal\system\Tests\Form\ElementTest
Same name and namespace in other branches
- 8.0 vendor/behat/mink/tests/Element/ElementTest.php \Behat\Mink\Tests\Element\ElementTest
Hierarchy
- class \Behat\Mink\Tests\Element\ElementTest extends \Behat\Mink\Tests\Element\PHPUnit_Framework_TestCase
Expanded class hierarchy of ElementTest
File
- vendor/
behat/ mink/ tests/ Element/ ElementTest.php, line 9
Namespace
Behat\Mink\Tests\ElementView source
abstract class ElementTest extends \PHPUnit_Framework_TestCase {
/**
* Session.
*
* @var Session
*/
protected $session;
/**
* @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $driver;
/**
* Selectors.
*
* @var SelectorsHandler|\PHPUnit_Framework_MockObject_MockObject
*/
protected $selectors;
protected function setUp() {
$this->driver = $this
->getMockBuilder('Behat\\Mink\\Driver\\DriverInterface')
->getMock();
$this->driver
->expects($this
->once())
->method('setSession');
$this->selectors = $this
->getMockBuilder('Behat\\Mink\\Selector\\SelectorsHandler')
->getMock();
$this->session = new Session($this->driver, $this->selectors);
}
protected function mockNamedFinder($xpath, array $results, $locator, $times = 2) {
if (!is_array($results[0])) {
$results = array(
$results,
array(),
);
}
// In case of empty results, a second call will be done using the partial selector
$processedResults = array();
foreach ($results as $result) {
$processedResults[] = $result;
if (empty($result)) {
$processedResults[] = $result;
++$times;
}
}
$returnValue = call_user_func_array(array(
$this,
'onConsecutiveCalls',
), $processedResults);
$this->driver
->expects($this
->exactly($times))
->method('find')
->with('//html' . $xpath)
->will($returnValue);
$this->selectors
->expects($this
->exactly($times))
->method('selectorToXpath')
->with($this
->logicalOr('named_exact', 'named_partial'), $locator)
->will($this
->returnValue($xpath));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ElementTest:: |
protected | property | ||
ElementTest:: |
protected | property | Selectors. | |
ElementTest:: |
protected | property | Session. | |
ElementTest:: |
protected | function | ||
ElementTest:: |
protected | function | 1 |