class ConfigActionsTest
Same name in this branch
- 11.x core/modules/media/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\media\Kernel\ConfigActionsTest
- 11.x core/modules/language/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\language\Kernel\ConfigActionsTest
- 11.x core/modules/field/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\field\Kernel\ConfigActionsTest
- 11.x core/modules/contact/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\contact\Kernel\ConfigActionsTest
- 11.x core/modules/node/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\node\Kernel\ConfigActionsTest
- 11.x core/modules/image/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\image\Kernel\ConfigActionsTest
- 11.x core/modules/block/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\block\Kernel\ConfigActionsTest
@group Recipe
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait
- class \Drupal\Tests\layout_builder\Kernel\ConfigActionsTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ConfigActionsTest
File
-
core/
modules/ layout_builder/ tests/ src/ Kernel/ ConfigActionsTest.php, line 15
Namespace
Drupal\Tests\layout_builder\KernelView source
class ConfigActionsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'entity_test',
'field',
'layout_builder',
'layout_discovery',
];
/**
* Tests config actions exposed by Layout Builder.
*/
public function testLayoutBuilderActions() : void {
/** @var \Drupal\Core\Config\Action\ConfigActionManager $manager */
$manager = $this->container
->get('plugin.manager.config_action');
EntityTestBundle::create([
'id' => 'test',
])->save();
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = $this->container
->get(EntityDisplayRepositoryInterface::class);
/** @var \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay $display */
$display = $display_repository->getViewDisplay('entity_test_with_bundle', 'test');
$this->assertInstanceOf(LayoutBuilderEntityViewDisplay::class, $display);
$display->save();
$this->assertFalse($display->isLayoutBuilderEnabled());
$manager->applyAction('enableLayoutBuilder', $display->getConfigDependencyName(), []);
$this->assertTrue($display_repository->getViewDisplay('entity_test_with_bundle', 'test')
->isLayoutBuilderEnabled());
$this->assertFalse($display->isOverridable());
$manager->applyAction('allowLayoutOverrides', $display->getConfigDependencyName(), TRUE);
$this->assertTrue($display_repository->getViewDisplay('entity_test_with_bundle', 'test')
->isOverridable());
$manager->applyAction('allowLayoutOverrides', $display->getConfigDependencyName(), FALSE);
$this->assertFalse($display_repository->getViewDisplay('entity_test_with_bundle', 'test')
->isOverridable());
$manager->applyAction('disableLayoutBuilder', $display->getConfigDependencyName(), []);
$this->assertFalse($display_repository->getViewDisplay('entity_test_with_bundle', 'test')
->isLayoutBuilderEnabled());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.