You are here

class CssSelectorTest in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/css-selector/Tests/CssSelectorTest.php \Symfony\Component\CssSelector\Tests\CssSelectorTest
  2. 8.0 vendor/behat/mink/tests/Selector/CssSelectorTest.php \Behat\Mink\Tests\Selector\CssSelectorTest
Same name and namespace in other branches
  1. 8 vendor/behat/mink/tests/Selector/CssSelectorTest.php \Behat\Mink\Tests\Selector\CssSelectorTest

Hierarchy

  • class \Behat\Mink\Tests\Selector\CssSelectorTest extends \Behat\Mink\Tests\Selector\PHPUnit_Framework_TestCase

Expanded class hierarchy of CssSelectorTest

File

vendor/behat/mink/tests/Selector/CssSelectorTest.php, line 7

Namespace

Behat\Mink\Tests\Selector
View source
class CssSelectorTest extends \PHPUnit_Framework_TestCase {
  protected function setUp() {
    if (!class_exists('Symfony\\Component\\CssSelector\\CssSelector')) {
      $this
        ->markTestSkipped('Symfony2 CssSelector component not installed');
    }
  }
  public function testSelector() {
    $selector = new CssSelector();
    $this
      ->assertEquals('descendant-or-self::h3', $selector
      ->translateToXPath('h3'));
    $this
      ->assertEquals('descendant-or-self::h3/span', $selector
      ->translateToXPath('h3 > span'));
    if (interface_exists('Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface')) {

      // The rewritten component of Symfony 2.3 checks for attribute existence first for the class.
      $expectation = "descendant-or-self::h3/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
    }
    else {
      $expectation = "descendant-or-self::h3/*[contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
    }
    $this
      ->assertEquals($expectation, $selector
      ->translateToXPath('h3 > .my_div'));
  }

  /**
   * @expectedException \InvalidArgumentException
   */
  public function testThrowsForArrayLocator() {
    $selector = new CssSelector();
    $selector
      ->translateToXPath(array(
      'h3',
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CssSelectorTest::setUp protected function
CssSelectorTest::testSelector public function
CssSelectorTest::testThrowsForArrayLocator public function @expectedException \InvalidArgumentException