public function LayoutBuilderTest::testSimpleConfigBasedLayout in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testSimpleConfigBasedLayout()
Tests a config-based implementation of Layout Builder.
See also
\Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage
File
- core/
modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTest.php, line 1274
Class
- LayoutBuilderTest
- Tests the Layout Builder UI.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
public function testSimpleConfigBasedLayout() {
$assert_session = $this
->assertSession();
$this
->drupalLogin($this
->createUser([
'configure any layout',
]));
// Prepare an object with a pre-existing section.
$this->container
->get('config.factory')
->getEditable('layout_builder_test.test_simple_config.existing')
->set('sections', [
(new Section('layout_twocol'))
->toArray(),
])
->save();
// The pre-existing section is found.
$this
->drupalGet('layout-builder-test-simple-config/existing');
$assert_session
->elementsCount('css', '.layout', 1);
$assert_session
->elementsCount('css', '.layout--twocol', 1);
// No layout is selected for a new object.
$this
->drupalGet('layout-builder-test-simple-config/new');
$assert_session
->elementNotExists('css', '.layout');
}