You are here

public function ScheduledTransitionTest::testInvalidPastSequence in Lightning Scheduler 8

Tests that a sequence that works in the future may not work in the past.

@depends testFutureSequence

File

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

Class

ScheduledTransitionTest
@group lightning_scheduler

Namespace

Drupal\Tests\lightning_scheduler\Functional

Code

public function testInvalidPastSequence() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet('/node/add/page');
  $assert_session
    ->statusCodeEquals(200);
  $page
    ->fillField('Title', 'Schedule This');
  $this
    ->setTransitionData('moderation_state[0][scheduled_transitions][data]', [
    [
      'when' => time() - 20,
      'state' => 'published',
    ],
    [
      'when' => time() - 10,
      'state' => 'archived',
    ],
  ]);
  $page
    ->pressButton('Save');
  $assert_session
    ->addressMatches('/^\\/node\\/[0-9]+$/');
  $edit_url = $this
    ->getUrl() . '/edit';
  $this
    ->cronRun();
  $this
    ->drupalGet($edit_url);
  $assert_session
    ->statusCodeEquals(200);
  $assert_session
    ->pageTextContains("Current state Draft");
}