MessageUiShowPreviewTest.php in Message UI 8
File
tests/src/Functional/MessageUiShowPreviewTest.php
View source
<?php
namespace Drupal\Tests\message_ui\Functional;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
class MessageUiShowPreviewTest extends AbstractTestMessageUi {
public function setUp() {
parent::setUp();
$this->account = $this
->drupalCreateUser();
$this->rid = Role::load(RoleInterface::AUTHENTICATED_ID)
->id();
$this
->createMessageTemplate('foo', 'Dummy test', 'Example text.', [
'Dummy message',
]);
$this
->grantMessageUiPermission('create');
$this
->configSet('show_preview', TRUE);
}
public function testMessageUiPreviewDisplaying() {
$this
->drupalLogin($this->account);
$this
->drupalGet('/message/add/foo');
$this
->assertSession()
->pageTextContains('Dummy message');
$this
->configSet('show_preview', FALSE);
drupal_static_reset();
$this
->drupalGet('/message/add/foo');
$this
->assertSession()
->pageTextNotContains('Dummy message');
}
}