function ViewsDataIntegrationTest::testContentModerationStateField
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ViewsDataIntegrationTest.php \Drupal\Tests\content_moderation\Kernel\ViewsDataIntegrationTest::testContentModerationStateField()
- 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsDataIntegrationTest.php \Drupal\Tests\content_moderation\Kernel\ViewsDataIntegrationTest::testContentModerationStateField()
- 11.x core/modules/content_moderation/tests/src/Kernel/ViewsDataIntegrationTest.php \Drupal\Tests\content_moderation\Kernel\ViewsDataIntegrationTest::testContentModerationStateField()
Tests the content moderation state views field.
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ViewsDataIntegrationTest.php, line 62
Class
- ViewsDataIntegrationTest
- Tests the views integration of content_moderation.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testContentModerationStateField() : void {
$node = Node::create([
'type' => 'page',
'title' => 'Test title',
]);
$node->moderation_state->value = 'published';
$node->save();
$view = Views::getView('test_content_moderation_field_state_test');
$view->execute();
$expected_result = [
[
'title' => 'Test title',
'moderation_state' => 'published',
],
];
$this->assertIdenticalResultset($view, $expected_result, [
'title' => 'title',
'moderation_state' => 'moderation_state',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.