You are here

public function NodeTest::testUpdateModerationStateFutureWithMorePagesAndArchivedContent in Scheduled Publish 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/NodeTest.php \Drupal\Tests\scheduled_publish\Kernel\NodeTest::testUpdateModerationStateFutureWithMorePagesAndArchivedContent()

File

tests/src/Kernel/NodeTest.php, line 141

Class

NodeTest
Class NodeTests

Namespace

Drupal\Tests\scheduled_publish\Kernel

Code

public function testUpdateModerationStateFutureWithMorePagesAndArchivedContent() {
  $page = Node::create([
    'type' => 'page',
    'title' => 'A',
  ]);
  $page->moderation_state->value = 'draft';
  $page
    ->set('field_scheduled_publish', [
    'moderation_state' => 'published',
    'value' => '2000-12-24T18:21Z',
  ]);
  $page
    ->save();
  $page->moderation_state->value = 'published';
  $page
    ->set('field_scheduled_publish', [
    'moderation_state' => 'archived',
    'value' => '2000-12-24T18:21Z',
  ]);
  $page
    ->save();
  $this->scheduledUpdateService
    ->doUpdate();
  $loadedNode = Node::load($page
    ->id());
  self::assertEquals('archived', $loadedNode->moderation_state->value);
}