You are here

protected function ScheduledTransitionTest::setUp in Lightning Scheduler 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ScheduledTransitionTest.php, line 28

Class

ScheduledTransitionTest
@group lightning_scheduler

Namespace

Drupal\Tests\lightning_scheduler\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);

  // Due to a known core bug, rebuilding the node access table will break the
  // entity query in TransitionManager::getTransitionable(). The workaround is
  // for the query to specifically disable access checking, which it should be
  // doing anyway because transitions need to be processed irrespective of
  // user access.
  // @see https://www.drupal.org/project/drupal/issues/2823957
  node_access_rebuild();
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'page');
  $workflow
    ->save();
  $account = $this
    ->drupalCreateUser([
    'create page content',
    'edit own page content',
    'view own unpublished content',
    'view latest version',
    'use editorial transition create_new_draft',
    'use editorial transition publish',
    'use editorial transition archive',
    'schedule editorial transition publish',
    'schedule editorial transition archive',
  ]);
  $this
    ->drupalLogin($account);
}