public function LayoutPluginTest::testFieldPlugin in Display Suite 8.3
Same name and namespace in other branches
- 8.4 tests/src/Functional/LayoutPluginTest.php \Drupal\Tests\ds\Functional\LayoutPluginTest::testFieldPlugin()
Test basic Display Suite layout plugins.
File
- tests/
src/ Functional/ LayoutPluginTest.php, line 15
Class
- LayoutPluginTest
- Tests DS layout plugins.
Namespace
Drupal\Tests\ds\FunctionalCode
public function testFieldPlugin() {
// Assert our 2 tests layouts are found.
$this
->drupalGet('admin/structure/types/manage/article/display');
$this
->assertSession()
->responseContains('Test One column');
$this
->assertSession()
->responseContains('Test Two column');
$layout = [
'ds_layout' => 'dstest_2col',
];
$assert = [
'regions' => [
'left' => '<td colspan="8">' . t('Left') . '</td>',
'right' => '<td colspan="8">' . t('Right') . '</td>',
],
];
$fields = [
'fields[node_author][region]' => 'left',
'fields[node_links][region]' => 'left',
'fields[body][region]' => 'right',
];
$this
->dsSelectLayout($layout, $assert);
$this
->dsConfigureUi($fields);
// Create a node.
$settings = [
'type' => 'article',
];
$node = $this
->drupalCreateNode($settings);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseContains('group-left');
$this
->assertSession()
->responseContains('group-right');
$this
->assertSession()
->responseContains('dstest-2col.css');
// Alter a region.
$settings = [
'type' => 'article',
'title' => 'Alter me!',
];
$node = $this
->drupalCreateNode($settings);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->responseContains('cool!');
}