You are here

public function NodeViewTest::testMultiByteUtf8 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeViewTest.php \Drupal\node\Tests\NodeViewTest::testMultiByteUtf8()

Tests that we store and retrieve multi-byte UTF-8 characters correctly.

File

core/modules/node/src/Tests/NodeViewTest.php, line 39
Contains \Drupal\node\Tests\NodeViewTest.

Class

NodeViewTest
Tests the node/{node} page.

Namespace

Drupal\node\Tests

Code

public function testMultiByteUtf8() {
  $title = '🐝';
  $this
    ->assertTrue(mb_strlen($title, 'utf-8') < strlen($title), 'Title has multi-byte characters.');
  $node = $this
    ->drupalCreateNode(array(
    'title' => $title,
  ));
  $this
    ->drupalGet($node
    ->urlInfo());
  $result = $this
    ->xpath('//span[contains(@class, "field--name-title")]');
  $this
    ->assertEqual((string) $result[0], $title, 'The passed title was returned.');
}