public function NodeTest::testUpdateModerationState in Scheduled Publish 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/NodeTest.php \Drupal\Tests\scheduled_publish\Kernel\NodeTest::testUpdateModerationState()
File
- tests/
src/ Kernel/ NodeTest.php, line 91
Class
- NodeTest
- Class NodeTests
Namespace
Drupal\Tests\scheduled_publish\KernelCode
public function testUpdateModerationState() {
$page = Node::create([
'type' => 'page',
'title' => 'A',
]);
$page->moderation_state->value = 'draft';
$page
->set('field_scheduled_publish', [
'moderation_state' => 'published',
'value' => '2007-12-24T18:21Z',
]);
$page
->save();
$nodeID = $page
->id();
self::assertTrue((bool) $nodeID);
$this->scheduledUpdateService
->doUpdate();
$loadedNode = Node::load($nodeID);
self::assertEquals('published', $loadedNode->moderation_state->value);
}