protected function BaseFieldMigrationTest::assertNode in Lightning Workflow 8.3
Same name and namespace in other branches
- 8.2 modules/lightning_scheduler/tests/src/Functional/BaseFieldMigrationTest.php \Drupal\Tests\lightning_scheduler\Functional\BaseFieldMigrationTest::assertNode()
1 call to BaseFieldMigrationTest::assertNode()
- BaseFieldMigrationTest::test in modules/
lightning_scheduler/ tests/ src/ Functional/ BaseFieldMigrationTest.php - Runs a basic test of migrating old Lightning Scheduler data.
File
- modules/
lightning_scheduler/ tests/ src/ Functional/ BaseFieldMigrationTest.php, line 80
Class
- BaseFieldMigrationTest
- @group lightning_workflow @group lightning_scheduler
Namespace
Drupal\Tests\lightning_scheduler\FunctionalCode
protected function assertNode(NodeInterface $node, $expected_date, $expected_state) {
$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
->assertFalse($date
->isEmpty());
$this
->assertFalse($state
->isEmpty());
$date_options = [
'timezone' => 'America/New_York',
];
$this
->assertSame($expected_date, $date->date
->format('Y-m-d H:i', $date_options));
$this
->assertSame($expected_state, $state->value);
}