You are here

public function ContentTest::testHtmlDecodingNotPerformed in Zircon Profile 8.0

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

File

vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php, line 68

Class

ContentTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testHtmlDecodingNotPerformed() {
  $session = $this
    ->getSession();
  $webAssert = $this
    ->getAssertSession();
  $session
    ->visit($this
    ->pathTo('/html_decoding.html'));
  $page = $session
    ->getPage();
  $span = $webAssert
    ->elementExists('css', 'span');
  $input = $webAssert
    ->elementExists('css', 'input');
  $expectedHtml = '<span custom-attr="&amp;">some text</span>';
  $this
    ->assertContains($expectedHtml, $page
    ->getHtml(), '.innerHTML is returned as-is');
  $this
    ->assertContains($expectedHtml, $page
    ->getContent(), '.outerHTML is returned as-is');
  $this
    ->assertEquals('&', $span
    ->getAttribute('custom-attr'), '.getAttribute value is decoded');
  $this
    ->assertEquals('&', $input
    ->getAttribute('value'), '.getAttribute value is decoded');
  $this
    ->assertEquals('&', $input
    ->getValue(), 'node value is decoded');
}