You are here

public function GeneralTest::testMultiInput in Zircon Profile 8.0

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

File

vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php, line 224

Class

GeneralTest

Namespace

Behat\Mink\Tests\Driver\Form

Code

public function testMultiInput() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/multi_input_form.html'));
  $page = $this
    ->getSession()
    ->getPage();
  $webAssert = $this
    ->getAssertSession();
  $this
    ->assertEquals('Multi input Test', $webAssert
    ->elementExists('css', 'h1')
    ->getText());
  $first = $webAssert
    ->fieldExists('First');
  $second = $webAssert
    ->fieldExists('Second');
  $third = $webAssert
    ->fieldExists('Third');
  $this
    ->assertEquals('tag1', $first
    ->getValue());
  $this
    ->assertSame('tag2', $second
    ->getValue());
  $this
    ->assertEquals('tag1', $third
    ->getValue());
  $first
    ->setValue('tag2');
  $this
    ->assertEquals('tag2', $first
    ->getValue());
  $this
    ->assertSame('tag2', $second
    ->getValue());
  $this
    ->assertEquals('tag1', $third
    ->getValue());
  $second
    ->setValue('one');
  $this
    ->assertEquals('tag2', $first
    ->getValue());
  $this
    ->assertSame('one', $second
    ->getValue());
  $third
    ->setValue('tag3');
  $this
    ->assertEquals('tag2', $first
    ->getValue());
  $this
    ->assertSame('one', $second
    ->getValue());
  $this
    ->assertEquals('tag3', $third
    ->getValue());
  $button = $page
    ->findButton('Register');
  $this
    ->assertNotNull($button);
  $button
    ->press();
  $space = ' ';
  $out = <<<OUT
  'tags' ={<span class="php-variable">$space</span>}
  array (
    0 = 'tag2',
    1 = 'one',
    2 = 'tag3',
  ),
OUT;
  $this
    ->assertContains($out, $page
    ->getContent());
}