function AreaTest::testUI
Same name in other branches
- 9 core/modules/views/tests/src/Functional/Handler/AreaTest.php \Drupal\Tests\views\Functional\Handler\AreaTest::testUI()
- 8.9.x core/modules/views/tests/src/Functional/Handler/AreaTest.php \Drupal\Tests\views\Functional\Handler\AreaTest::testUI()
- 10 core/modules/views/tests/src/Functional/Handler/AreaTest.php \Drupal\Tests\views\Functional\Handler\AreaTest::testUI()
Tests the generic UI of an area handler.
File
-
core/
modules/ views/ tests/ src/ Functional/ Handler/ AreaTest.php, line 61
Class
- AreaTest
- Tests the plugin base of the area handler.
Namespace
Drupal\Tests\views\Functional\HandlerCode
public function testUI() : void {
$admin_user = $this->drupalCreateUser([
'administer views',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$types = [
'header',
'footer',
'empty',
];
$labels = [];
foreach ($types as $type) {
$edit_path = 'admin/structure/views/nojs/handler/test_example_area/default/' . $type . '/test_example';
// First setup an empty label.
$this->drupalGet($edit_path);
$this->submitForm([], 'Apply');
$this->assertSession()
->pageTextContains('Test Example area');
// Then setup a no empty label.
$labels[$type] = $this->randomMachineName();
$this->drupalGet($edit_path);
$this->submitForm([
'options[admin_label]' => $labels[$type],
], 'Apply');
// Make sure that the new label appears on the site.
$this->assertSession()
->pageTextContains($labels[$type]);
// Test that the settings (empty/admin_label) are accessible.
$this->drupalGet($edit_path);
$this->assertSession()
->fieldExists('options[admin_label]');
if ($type !== 'empty') {
$this->assertSession()
->fieldExists('options[empty]');
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.