public function ScheduledTransitionSettingsFormTest::testNoPermissionsMessage in Scheduled Transitions 2.x
Same name and namespace in other branches
- 8 tests/src/Functional/ScheduledTransitionSettingsFormTest.php \Drupal\Tests\scheduled_transitions\Functional\ScheduledTransitionSettingsFormTest::testNoPermissionsMessage()
Tests permission message on form.
File
- tests/
src/ Functional/ ScheduledTransitionSettingsFormTest.php, line 126
Class
- ScheduledTransitionSettingsFormTest
- Tests settings form.
Namespace
Drupal\Tests\scheduled_transitions\FunctionalCode
public function testNoPermissionsMessage() : void {
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('st_entity_test', 'st_entity_test');
$workflow
->save();
$this
->enabledBundles([
[
'st_entity_test',
'st_entity_test',
],
]);
$message = 'Notice: no roles are currently granted permissions for this type.';
$currentUser = $this
->drupalCreateUser([
'administer scheduled transitions',
]);
$this
->drupalLogin($currentUser);
$url = Url::fromRoute('scheduled_transitions.settings');
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains($message);
$testRole = Role::create([
'id' => 'test_role',
]);
$testRole
->grantPermission(Permissions::viewScheduledTransitionsPermission('st_entity_test', 'st_entity_test'));
$testRole
->save();
$this
->drupalGet($url);
$this
->assertSession()
->pageTextNotContains($message);
}