ModerationControlTest.php in Lightning Workflow 8.3
File
tests/src/Kernel/ModerationControlTest.php
View source
<?php
namespace Drupal\Tests\lightning_workflow\Kernel;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
class ModerationControlTest extends KernelTestBase {
use ContentTypeCreationTrait;
protected static $modules = [
'content_moderation',
'field',
'lightning_workflow',
'node',
'system',
'text',
'user',
'workflows',
];
protected function setUp() {
parent::setUp();
$this
->installConfig('lightning_workflow');
$this
->installConfig('node');
$this
->createContentType([
'type' => 'page',
'third_party_settings' => [
'lightning_workflow' => [
'workflow' => 'editorial',
],
],
]);
EntityViewDisplay::load('node.page.default')
->delete();
}
public function testHiddenOnModerationSidebarInstall() {
$values = [
'targetEntityType' => 'node',
'bundle' => 'page',
'mode' => 'default',
'status' => TRUE,
];
$this
->assertArrayHasKey('content_moderation_control', EntityViewDisplay::create($values)
->getComponents());
$this->container
->get('module_installer')
->install([
'moderation_sidebar',
]);
$hidden = EntityViewDisplay::create($values)
->get('hidden');
$this
->assertTrue($hidden['content_moderation_control']);
}
}