ModerationSidebarTest.php in Lightning Workflow 8.3
File
tests/src/Functional/ModerationSidebarTest.php
View source
<?php
namespace Drupal\Tests\lightning_workflow\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\Entity\Role;
class ModerationSidebarTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'lightning_page',
'lightning_roles',
'lightning_workflow',
'moderation_sidebar',
'toolbar',
];
public function test($role) {
$role = Role::load($role);
$this
->assertInstanceOf(Role::class, $role);
$this
->assertTrue($role
->hasPermission('access toolbar'));
$this
->assertTrue($role
->hasPermission('use moderation sidebar'));
$user = $this
->createUser();
$user
->addRole($role
->id());
$user
->save();
$this
->drupalLogin($user);
$node = $this
->createNode([
'title' => 'Foo Bar',
'type' => 'page',
]);
$this
->drupalGet($node
->toUrl());
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->linkExists('Tasks');
}
public function provider() {
return [
[
'page_creator',
],
[
'page_reviewer',
],
];
}
}