You are here

class ManipulatorTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/tests/Selector/Xpath/ManipulatorTest.php \Behat\Mink\Tests\Selector\Xpath\ManipulatorTest

Hierarchy

  • class \Behat\Mink\Tests\Selector\Xpath\ManipulatorTest extends \Behat\Mink\Tests\Selector\Xpath\PHPUnit_Framework_TestCase

Expanded class hierarchy of ManipulatorTest

File

vendor/behat/mink/tests/Selector/Xpath/ManipulatorTest.php, line 7

Namespace

Behat\Mink\Tests\Selector\Xpath
View source
class ManipulatorTest extends \PHPUnit_Framework_TestCase {

  /**
   * @dataProvider getPrependedXpath
   */
  public function testPrepend($prefix, $xpath, $expectedXpath) {
    $manipulator = new Manipulator();
    $this
      ->assertEquals($expectedXpath, $manipulator
      ->prepend($xpath, $prefix));
  }
  public function getPrependedXpath() {
    return array(
      'simple' => array(
        'some_xpath',
        'some_tag1',
        'some_xpath/some_tag1',
      ),
      'with slash' => array(
        'some_xpath',
        '/some_tag1',
        'some_xpath/some_tag1',
      ),
      'union' => array(
        'some_xpath',
        'some_tag1 | some_tag2',
        'some_xpath/some_tag1 | some_xpath/some_tag2',
      ),
      'wrapped union' => array(
        'some_xpath',
        '(some_tag1 | some_tag2)/some_child',
        '(some_xpath/some_tag1 | some_xpath/some_tag2)/some_child',
      ),
      'multiple wrapped union' => array(
        'some_xpath',
        '( ( some_tag1 | some_tag2)/some_child | some_tag3)/leaf',
        '( ( some_xpath/some_tag1 | some_xpath/some_tag2)/some_child | some_xpath/some_tag3)/leaf',
      ),
      'parent union' => array(
        'some_xpath | another_xpath',
        'some_tag1 | some_tag2',
        '(some_xpath | another_xpath)/some_tag1 | (some_xpath | another_xpath)/some_tag2',
      ),
      'complex condition' => array(
        'some_xpath',
        'some_tag1 | some_tag2[@foo = "bar|"] | some_tag3[foo | bar]',
        'some_xpath/some_tag1 | some_xpath/some_tag2[@foo = "bar|"] | some_xpath/some_tag3[foo | bar]',
      ),
      'multiline' => array(
        'some_xpath',
        "some_tag1 | some_tag2[@foo =\n 'bar|'']\n | some_tag3[foo | bar]",
        "some_xpath/some_tag1 | some_xpath/some_tag2[@foo =\n 'bar|''] | some_xpath/some_tag3[foo | bar]",
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ManipulatorTest::getPrependedXpath public function
ManipulatorTest::testPrepend public function @dataProvider getPrependedXpath