You are here

class RadioTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/driver-testsuite/tests/Form/RadioTest.php \Behat\Mink\Tests\Driver\Form\RadioTest

Hierarchy

  • class \Behat\Mink\Tests\Driver\TestCase extends \Behat\Mink\Tests\Driver\PHPUnit_Framework_TestCase
    • class \Behat\Mink\Tests\Driver\Form\RadioTest

Expanded class hierarchy of RadioTest

File

vendor/behat/mink/driver-testsuite/tests/Form/RadioTest.php, line 7

Namespace

Behat\Mink\Tests\Driver\Form
View source
class RadioTest extends TestCase {
  protected function setUp() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('radio.html'));
  }
  public function testIsChecked() {
    $option = $this
      ->findById('first');
    $option2 = $this
      ->findById('second');
    $this
      ->assertTrue($option
      ->isChecked());
    $this
      ->assertFalse($option2
      ->isChecked());
    $option2
      ->selectOption('updated');
    $this
      ->assertFalse($option
      ->isChecked());
    $this
      ->assertTrue($option2
      ->isChecked());
  }
  public function testSelectOption() {
    $option = $this
      ->findById('first');
    $this
      ->assertEquals('set', $option
      ->getValue());
    $option
      ->selectOption('updated');
    $this
      ->assertEquals('updated', $option
      ->getValue());
    $option
      ->selectOption('set');
    $this
      ->assertEquals('set', $option
      ->getValue());
  }
  public function testSetValue() {
    $option = $this
      ->findById('first');
    $this
      ->assertEquals('set', $option
      ->getValue());
    $option
      ->setValue('updated');
    $this
      ->assertEquals('updated', $option
      ->getValue());
    $this
      ->assertFalse($option
      ->isChecked());
  }
  public function testSameNameInMultipleForms() {
    $option1 = $this
      ->findById('reused_form1');
    $option2 = $this
      ->findById('reused_form2');
    $this
      ->assertEquals('test2', $option1
      ->getValue());
    $this
      ->assertEquals('test3', $option2
      ->getValue());
    $option1
      ->selectOption('test');
    $this
      ->assertEquals('test', $option1
      ->getValue());
    $this
      ->assertEquals('test3', $option2
      ->getValue());
  }

  /**
   * @see https://github.com/Behat/MinkSahiDriver/issues/32
   */
  public function testSetValueXPathEscaping() {
    $session = $this
      ->getSession();
    $session
      ->visit($this
      ->pathTo('/advanced_form.html'));
    $page = $session
      ->getPage();
    $sex = $page
      ->find('xpath', '//*[@name = "sex"]' . "\n|\n" . '//*[@id = "sex"]');
    $this
      ->assertNotNull($sex, 'xpath with line ending works');
    $sex
      ->setValue('m');
    $this
      ->assertEquals('m', $sex
      ->getValue(), 'no double xpath escaping during radio button value change');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RadioTest::setUp protected function
RadioTest::testIsChecked public function
RadioTest::testSameNameInMultipleForms public function
RadioTest::testSelectOption public function
RadioTest::testSetValue public function
RadioTest::testSetValueXPathEscaping public function
TestCase::$config private static property
TestCase::$mink private static property Mink session manager.
TestCase::checkRequirements protected function
TestCase::createDriver protected function Creates a new driver instance.
TestCase::findById protected function
TestCase::getAssertSession protected function Returns assert session.
TestCase::getConfig private static function
TestCase::getSession protected function Returns session.
TestCase::mapRemoteFilePath protected function Map remote file path.
TestCase::onNotSuccessfulTest protected function
TestCase::pathTo protected function
TestCase::safePageWait protected function Waits for a condition to be true, considering than it is successful for drivers not supporting wait().
TestCase::setUpBeforeClass public static function Initializes the test case.
TestCase::tearDown protected function