public function SiteStatusMessageTokenTestCase::testSiteStatusMessageToken in Site Status Message 7
Test token functionality works as expected.
File
- tests/
site_status_message_token.test, line 38 - Token tests for Site Status Message module.
Class
- SiteStatusMessageTokenTestCase
- Class SiteStatusMessageTokenTestCase.
Code
public function testSiteStatusMessageToken() {
// Set site name.
variable_set('site_name', 'Drupal');
// Create an Admin user.
$this
->adminLogin();
// Create a dummy Article node.
$node = $this
->drupalCreateNode(array(
'type' => 'article',
));
// Message variables.
$message = '[site:name] Site.';
// Settings form variables.
$edit = array(
'site_status_message_message' => $message,
'site_status_message_showlink' => FALSE,
'site_status_message_link' => '',
'site_status_message_readmore' => '',
'site_status_message_display_options' => 'both',
);
$this
->drupalGet($this->siteStatusMessageAdminPage);
// Check for the Token browser.
$this
->assertText(t('This field supports tokens.'), 'Token UI message is showing.');
$this
->assertLink('Browse available tokens.', 0, 'Check the Token UI link is on the admin page.');
$this
->drupalPost($this->siteStatusMessageAdminPage, $edit, 'Save configuration');
$this
->drupalGet('node/' . $node->nid);
$this
->assertRaw('<div id="site-status-message" class="site-status-message" role="alert">', 'Check the Site Status Message html div appears on the page.');
$this
->assertText(t('Drupal Site.'), 'Check that Site Status Message text is showing on a content page with the token replaced.');
}