HelpPageTest.php in Token 8
File
tests/src/Functional/Tree/HelpPageTest.php
View source
<?php
namespace Drupal\Tests\token\Functional\Tree;
use Drupal\Tests\token\Functional\TokenTestBase;
class HelpPageTest extends TokenTestBase {
use TokenTreeTestTrait;
protected $account;
public static $modules = [
'help',
];
public function setUp() {
parent::setUp();
$this->account = $this
->drupalCreateUser([
'access administration pages',
]);
$this
->drupalLogin($this->account);
}
public function testHelpPageTree() {
$this
->drupalGet('admin/help/token');
$this
->assertText('The list of the currently available tokens on this site are shown below.');
$this
->assertTokenGroup('Current date');
$this
->assertTokenGroup('Site information');
$this
->assertTokenInTree('[current-date:html_date]', 'current-date');
$this
->assertTokenInTree('[current-date:html_week]', 'current-date');
$this
->assertTokenInTree('[date:html_date]', 'date');
$this
->assertTokenInTree('[date:html_week]', 'date');
$this
->assertTokenInTree('[current-user:account-name]', 'current-user');
$this
->assertTokenInTree('[user:account-name]', 'user');
$this
->assertTokenInTree('[current-page:url:unaliased]', 'current-page--url');
$this
->assertTokenInTree('[current-page:url:unaliased:args]', 'current-page--url--unaliased');
$this
->assertTokenInTree('[user:original:account-name]', 'user--original');
$this
->assertTokenInTree('[user:one-time-login-url]', 'user');
$this
->assertTokenInTree('[user:original:cancel-url]', 'user--original');
$this
->assertTokenNotGroup('Array');
$this
->assertTokenNotGroup('user:roles');
$this
->assertTokenInTree('[user:roles]', 'user');
}
}