You are here

public function PublishedStateConstraintTest::testValidPublishStateTransition in Scheduler content moderation integration 8

Test valid publish state transitions.

@covers ::validate

File

tests/src/Kernel/PublishedStateConstraintTest.php, line 32

Class

PublishedStateConstraintTest
Test covering the PublishedStateConstraintValidator.

Namespace

Drupal\Tests\scheduler_content_moderation_integration\Kernel

Code

public function testValidPublishStateTransition() {
  $node = Node::create([
    'type' => 'example',
    'title' => 'Test title',
    'moderation_state' => 'draft',
    'publish_on' => strtotime('tomorrow'),
    'publish_state' => 'published',
  ]);

  // Assert that the publish state passes validation.
  $violations = $node
    ->validate();
  $this
    ->assertCount(0, $violations);
}