You are here

public function UnPublishedStateConstraintTest::testValidPublishStateToUnPublishStateTransition in Scheduler content moderation integration 8

Test published to unpublished transition.

Test valid scheduled publishing state to valid scheduled un-publish state transitions.

@covers ::validate

File

tests/src/Kernel/UnPublishedStateConstraintTest.php, line 35

Class

UnPublishedStateConstraintTest
Test covering the UnPublishedStateConstraintValidator.

Namespace

Drupal\Tests\scheduler_content_moderation_integration\Kernel

Code

public function testValidPublishStateToUnPublishStateTransition() {
  $node = Node::create([
    'type' => 'example',
    'title' => 'Test title',
    'moderation_state' => 'draft',
    'unpublish_on' => strtotime('+3 days'),
    'publish_on' => strtotime('+2 days'),
    'unpublish_state' => 'archived',
    'publish_state' => 'published',
  ]);
  $violations = $node
    ->validate();
  $this
    ->assertCount(0, $violations);
}