public function ModeratedContentSchedulingTest::testUnpublishStateSchedule in Thunder 8.4
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/ModeratedContentSchedulingTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModeratedContentSchedulingTest::testUnpublishStateSchedule()
- 8.3 tests/src/FunctionalJavascript/ModeratedContentSchedulingTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModeratedContentSchedulingTest::testUnpublishStateSchedule()
- 6.2.x tests/src/FunctionalJavascript/ModeratedContentSchedulingTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModeratedContentSchedulingTest::testUnpublishStateSchedule()
- 6.0.x tests/src/FunctionalJavascript/ModeratedContentSchedulingTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModeratedContentSchedulingTest::testUnpublishStateSchedule()
- 6.1.x tests/src/FunctionalJavascript/ModeratedContentSchedulingTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModeratedContentSchedulingTest::testUnpublishStateSchedule()
Tests moderated nodes unpublish scheduling.
File
- tests/
src/ FunctionalJavascript/ ModeratedContentSchedulingTest.php, line 77
Class
- ModeratedContentSchedulingTest
- Tests publishing/unpublishing scheduling for moderated nodes.
Namespace
Drupal\Tests\thunder\FunctionalJavascriptCode
public function testUnpublishStateSchedule() {
$this
->articleFillNew([
'field_channel' => 1,
'title[0][value]' => 'Test workflow article 2 - Published',
'field_seo_title[0][value]' => 'Massive gaining seo traffic text 2',
'moderation_state[0]' => 'published',
'unpublish_on[0][value][date]' => date('Y-m-d', strtotime('tomorrow')),
'unpublish_state[0]' => 'unpublished',
]);
$this
->clickSave();
$node = $this
->getNodeByTitle('Test workflow article 2 - Published');
// Set date manually, unpublish cannot be in the past.
$node->unpublish_on->value = strtotime('yesterday');
$node
->save();
$revision_id = $node
->getRevisionId();
// Make sure node is published.
$this
->assertEquals(TRUE, Node::load($node
->id())
->isPublished());
$this->container
->get('cron')
->run();
// Assert node is now unpublished.
$this
->assertEquals(FALSE, Node::load($node
->id())
->isPublished());
// Assert only one revision is created during the operation.
$this
->assertEquals($revision_id + 1, Node::load($node
->id())
->getRevisionId());
}