class ItemLayoutFieldBlockTest
Same name and namespace in other branches
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest
- 10 core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/ItemLayoutFieldBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest
Field blocks tests for the override layout.
@group layout_builder
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\layout_builder\FunctionalJavascript\ItemLayoutFieldBlockTest extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ItemLayoutFieldBlockTest
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ItemLayoutFieldBlockTest.php, line 13
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptView source
class ItemLayoutFieldBlockTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'layout_builder',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
]));
// We need more then one content type for this test.
$this->createContentType([
'type' => 'bundle_with_layout_overrides',
]);
LayoutBuilderEntityViewDisplay::load('node.bundle_with_layout_overrides.default')->enableLayoutBuilder()
->setOverridable()
->save();
$this->createContentType([
'type' => 'filler_bundle',
]);
}
/**
* Tests configuring a field block for a user field.
*/
public function testAddAjaxBlock() {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
// Start by creating a node of type with layout overrides.
$node = $this->createNode([
'type' => 'bundle_with_layout_overrides',
'body' => [
[
'value' => 'The node body',
],
],
]);
$node->save();
// Open single item layout page.
$this->drupalGet('node/1/layout');
// Add a new block.
$this->clickLink('Add block');
$assert_session->assertWaitOnAjaxRequest();
// Validate that only field blocks for layouted bundle are present.
$valid_links = $page->findAll('css', 'a[href$="field_block%3Anode%3Abundle_with_layout_overrides%3Abody"]');
$this->assertCount(1, $valid_links);
$invalid_links = $page->findAll('css', 'a[href$="field_block%3Anode%3Afiller_bundle%3Abody"]');
$this->assertCount(0, $invalid_links);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.