public function ScheduledTransitionTest::testFutureSequence in Lightning Scheduler 8
Tests scheduling a series of valid transitions in the future.
File
- tests/
src/ Functional/ ScheduledTransitionTest.php, line 136
Class
- ScheduledTransitionTest
- @group lightning_scheduler
Namespace
Drupal\Tests\lightning_scheduler\FunctionalCode
public function testFutureSequence() {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$now = time();
$this
->drupalGet('/node/add/page');
$assert_session
->statusCodeEquals(200);
$page
->fillField('Title', 'Schedule This');
$this
->setTransitionData('moderation_state[0][scheduled_transitions][data]', [
[
'when' => $now + 10,
'state' => 'published',
],
[
'when' => $now + 20,
'state' => 'archived',
],
]);
$page
->pressButton('Save');
$assert_session
->addressMatches('/^\\/node\\/[0-9]+$/');
$edit_url = $this
->getUrl() . '/edit';
$this
->setRequestTime($now + 12);
$this
->cronRun();
$this
->setRequestTime($now + 24);
$this
->cronRun();
$this
->drupalGet($edit_url);
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains("Current state Archived");
}