public function Update8006Test::test in Lightning Workflow 8.3
Tests lightning_workflow_update_8006().
File
- tests/
src/ Functional/ Update8006Test.php, line 28
Class
Namespace
Drupal\Tests\lightning_workflow\FunctionalCode
public function test() {
/** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
$storage = $this->container
->get('entity_type.manager')
->getStorage('view');
/** @var \Drupal\views\Entity\View $view */
$view = $storage
->load('moderation_history');
$this
->assertInstanceOf(View::class, $view);
$display = $view
->getDisplay('default');
$this
->assertArrayHasKey('moderation_state', $display['display_options']['relationships']);
$field = $display['display_options']['fields']['moderation_state'];
$this
->assertSame('content_moderation_state_field_revision', $field['table']);
$this
->assertSame('moderation_state', $field['relationship']);
$this
->assertSame('content_moderation_state', $field['entity_type']);
$this
->assertSame('moderation_state', $field['entity_field']);
$this
->runUpdates();
$storage
->resetCache([
'moderation_history',
]);
$view = $storage
->load('moderation_history');
$this
->assertInstanceOf(View::class, $view);
$display = $view
->getDisplay('default');
$this
->assertArrayNotHasKey('moderation_state', $display['display_options']['relationships']);
$field = $display['display_options']['fields']['moderation_state'];
$this
->assertSame('node_field_revision', $field['table']);
$this
->assertSame('none', $field['relationship']);
$this
->assertSame('node', $field['entity_type']);
$this
->assertArrayNotHasKey('entity_field', $field);
}