public function MediaTest::testUpdateModerationStateFutureWithMorePagesAndArchivedContent in Scheduled Publish 8.2
Same name and namespace in other branches
- 8.3 tests/src/Kernel/MediaTest.php \Drupal\Tests\scheduled_publish\Kernel\MediaTest::testUpdateModerationStateFutureWithMorePagesAndArchivedContent()
File
- tests/
src/ Kernel/ MediaTest.php, line 141
Class
- MediaTest
- Class MediaTests
Namespace
Drupal\Tests\scheduled_publish\KernelCode
public function testUpdateModerationStateFutureWithMorePagesAndArchivedContent() {
$entity = Media::create([
'bundle' => $this->testMediaType
->id(),
'name' => 'A',
'field_media_test' => 'something',
]);
$entity->moderation_state->value = 'draft';
$entity
->set('field_scheduled_publish', [
'moderation_state' => 'published',
'value' => '2000-12-24T18:21Z',
]);
$entity
->save();
$entity->moderation_state->value = 'published';
$entity
->set('field_scheduled_publish', [
'moderation_state' => 'archived',
'value' => '2000-12-24T18:21Z',
]);
$entity
->save();
$this->scheduledUpdateService
->doUpdate();
$loadedEntity = Media::load($entity
->id());
self::assertEquals('archived', $loadedEntity->moderation_state->value);
}