You are here

public function CommonTest::testUpdateModerationStateFuture in Scheduled Publish 8

File

tests/src/Kernel/CommonTest.php, line 112

Class

CommonTest
Class CommonTest

Namespace

Drupal\Tests\scheduled_publish\Kernel

Code

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