TokenizeAreaUITest.php in Drupal 9
File
core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php
View source
<?php
namespace Drupal\Tests\views_ui\Functional;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\views\Entity\View;
class TokenizeAreaUITest extends UITestBase {
protected static $modules = [
'entity_test',
];
protected $defaultTheme = 'stark';
public function testTokenUI() {
$entity_test = EntityTest::create([
'bundle' => 'entity_test',
]);
$entity_test
->save();
$default = $this
->randomView([]);
$id = $default['id'];
$view = View::load($id);
$this
->drupalGet($view
->toUrl('edit-form'));
$this
->drupalGet("admin/structure/views/nojs/add-handler/{$id}/page_1/argument");
$this
->submitForm([
'name[views.null]' => 1,
], 'Add and configure contextual filters');
$this
->submitForm([], 'Apply');
$this
->drupalGet("admin/structure/views/nojs/add-handler/{$id}/page_1/header");
$this
->submitForm([
'name[views.area]' => 'views.area',
], 'Add and configure header');
$this
->assertSession()
->pageTextContains('{{ title }} == Content: Title');
$this
->assertSession()
->pageTextContains('{{ arguments.null }} == Global: Null title');
}
}