You are here

public function NavigationTest::testLinks in Zircon Profile 8.0

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

File

vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php, line 37

Class

NavigationTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testLinks() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/links.html'));
  $page = $this
    ->getSession()
    ->getPage();
  $link = $page
    ->findLink('Redirect me to');
  $this
    ->assertNotNull($link);
  $this
    ->assertRegExp('/redirector\\.php$/', $link
    ->getAttribute('href'));
  $link
    ->click();
  $this
    ->assertEquals($this
    ->pathTo('/redirect_destination.html'), $this
    ->getSession()
    ->getCurrentUrl());
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/links.html'));
  $page = $this
    ->getSession()
    ->getPage();
  $link = $page
    ->findLink('basic form image');
  $this
    ->assertNotNull($link);
  $this
    ->assertRegExp('/basic_form\\.html$/', $link
    ->getAttribute('href'));
  $link
    ->click();
  $this
    ->assertEquals($this
    ->pathTo('/basic_form.html'), $this
    ->getSession()
    ->getCurrentUrl());
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/links.html'));
  $page = $this
    ->getSession()
    ->getPage();
  $link = $page
    ->findLink('Link with a ');
  $this
    ->assertNotNull($link);
  $this
    ->assertRegExp('/links\\.html\\?quoted$/', $link
    ->getAttribute('href'));
  $link
    ->click();
  $this
    ->assertEquals($this
    ->pathTo('/links.html?quoted'), $this
    ->getSession()
    ->getCurrentUrl());
}