You are here

protected function PurgeTest::assertNode in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8.2 modules/lightning_scheduler/tests/src/Functional/PurgeTest.php \Drupal\Tests\lightning_scheduler\Functional\PurgeTest::assertNode()

Asserts that a node has had its scheduling data purged correctly.

Parameters

\Drupal\node\NodeInterface $node: The node to check.

1 call to PurgeTest::assertNode()
PurgeTest::test in modules/lightning_scheduler/tests/src/Functional/PurgeTest.php
Runs a basic test of migrating old Lightning Scheduler data.

File

modules/lightning_scheduler/tests/src/Functional/PurgeTest.php, line 82

Class

PurgeTest
Tests purging of old Lightning Scheduler data, without migrating it.

Namespace

Drupal\Tests\lightning_scheduler\Functional

Code

protected function assertNode(NodeInterface $node) {
  $this
    ->assertFalse($node
    ->hasField('scheduled_publication'));
  $this
    ->assertFalse($node
    ->hasField('scheduled_moderation_state'));
  $this
    ->assertTrue($node
    ->hasField('scheduled_transition_date'));
  $this
    ->assertTrue($node
    ->hasField('scheduled_transition_state'));
  $date = $node
    ->get('scheduled_transition_date');
  $state = $node
    ->get('scheduled_transition_state');
  $this
    ->assertSame(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, $date
    ->getFieldDefinition()
    ->getFieldStorageDefinition()
    ->getCardinality());
  $this
    ->assertSame(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, $state
    ->getFieldDefinition()
    ->getFieldStorageDefinition()
    ->getCardinality());
  $this
    ->assertTrue($date
    ->isEmpty());
  $this
    ->assertTrue($state
    ->isEmpty());
}