3 namespace Drupal\views_ui\Tests;
5 use Drupal\entity_test\Entity\EntityTest;
6 use Drupal\views\Entity\View;
9 * Tests the token display for the TokenizeAreaPluginBase UI.
11 * @see \Drupal\views\Plugin\views\area\Entity
14 class TokenizeAreaUITest extends UITestBase {
19 public static $modules = ['entity_test'];
22 * Test that the right tokens are shown as available for replacement.
24 public function testTokenUI() {
25 $entity_test = EntityTest::create(['bundle' => 'entity_test']);
28 $default = $this->randomView([]);
30 $view = View::load($id);
32 $this->drupalGet($view->toUrl('edit-form'));
34 // Add a global NULL argument to the view for testing argument tokens.
35 $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/argument", ['name[views.null]' => 1], 'Add and configure contextual filters');
36 $this->drupalPostForm(NULL, [], 'Apply');
38 $this->drupalPostForm("admin/structure/views/nojs/add-handler/$id/page_1/header", ['name[views.area]' => 'views.area'], 'Add and configure header');
39 // Test that field tokens are shown.
40 $this->assertText('{{ title }} == Content: Title');
41 // Test that argument tokens are shown.
42 $this->assertText('{{ arguments.null }} == Global: Null title');