public function TransitionTest::testScheduledPublishAndUnpublishInFuture in Lightning Workflow 8.3
Tests automatically publishing, and then unpublishing, in the future.
File
- modules/
lightning_scheduler/ tests/ src/ FunctionalJavascript/ TransitionTest.php, line 150
Class
- TransitionTest
- Tests Lightning Scheduler's transition handling.
Namespace
Drupal\Tests\lightning_scheduler\FunctionalJavascriptCode
public function testScheduledPublishAndUnpublishInFuture() {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$account = $this
->drupalCreateUser([
'administer nodes',
'create page content',
'edit own page content',
'schedule editorial transition archive',
'schedule editorial transition publish',
'use editorial transition archive',
'use editorial transition create_new_draft',
'use editorial transition publish',
'use editorial transition review',
'view latest version',
'view own unpublished content',
]);
$this
->drupalLogin($account);
$this
->drupalGet('/node/add/page');
$page
->fillField('Title', 'Schedule This');
$now = time();
$this
->createTransition('Published', $now + 10);
$this
->createTransition('Archived', $now + 20);
$page
->pressButton('Save');
$this
->cronRun($now + 12);
$this
->cronRun($now + 22);
$this
->drupalGet('/node/1/edit');
$assert_session
->pageTextContains('Current state Archived');
$assert_session
->elementNotExists('css', '.scheduled-transition');
}