Backup of db before drupal security update
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / TokenizeAreaUITest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 use Drupal\entity_test\Entity\EntityTest;
6 use Drupal\views\Entity\View;
7
8 /**
9  * Tests the token display for the TokenizeAreaPluginBase UI.
10  *
11  * @see \Drupal\views\Plugin\views\area\Entity
12  * @group views_ui
13  */
14 class TokenizeAreaUITest extends UITestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['entity_test'];
20
21   /**
22    * Test that the right tokens are shown as available for replacement.
23    */
24   public function testTokenUI() {
25     $entity_test = EntityTest::create(['bundle' => 'entity_test']);
26     $entity_test->save();
27
28     $default = $this->randomView([]);
29     $id = $default['id'];
30     $view = View::load($id);
31
32     $this->drupalGet($view->toUrl('edit-form'));
33
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');
37
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');
43   }
44
45 }