SupportTicketViewTest.php in Support Ticketing System 8
File
modules/support_ticket/src/Tests/SupportTicketViewTest.php
View source
<?php
namespace Drupal\support_ticket\Tests;
class SupportTicketViewTest extends SupportTicketTestBase {
public static $modules = array(
'support_ticket_test',
);
protected function setUp() {
parent::setUp();
$web_user = $this
->drupalCreateUser(array(
'access support tickets',
));
$this
->drupalLogin($web_user);
}
public function testHtmlHeadLinks() {
$support_ticket = $this
->drupalCreateSupportTicket();
$this
->drupalGet($support_ticket
->urlInfo());
$result = $this
->xpath('//link[@rel = "version-history"]');
$this
->assertEqual($result[0]['href'], $support_ticket
->url('version-history'));
$result = $this
->xpath('//link[@rel = "edit-form"]');
$this
->assertEqual($result[0]['href'], $support_ticket
->url('edit-form'));
$result = $this
->xpath('//link[@rel = "canonical"]');
$this
->assertEqual($result[0]['href'], $support_ticket
->url());
}
public function testMultiByteUtf8() {
$title = '🐝';
$this
->assertTrue(mb_strlen($title, 'utf-8') < strlen($title), 'Title has multi-byte characters.');
$support_ticket = $this
->drupalCreateSupportTicket(array(
'title' => $title,
));
$this
->drupalGet($support_ticket
->urlInfo());
$result = $this
->xpath('//span[contains(@class, "field--name-title")]');
$this
->assertEqual((string) $result[0], $title, 'The passed title was returned.');
}
}