Backup of db before drupal security update
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / WizardTest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 use Drupal\Tests\views\Functional\Wizard\WizardTestBase;
6
7 /**
8  * Tests the wizard.
9  *
10  * @group views_ui
11  * @see \Drupal\views\Plugin\views\display\DisplayPluginBase
12  * @see \Drupal\views\Plugin\views\display\PathPluginBase
13  * @see \Drupal\views\Plugin\views\wizard\WizardPluginBase
14  */
15 class WizardTest extends WizardTestBase {
16
17   /**
18    * Tests filling in the wizard with really long strings.
19    */
20   public function testWizardFieldLength() {
21     $view = [];
22     $view['label'] = $this->randomMachineName(256);
23     $view['id'] = strtolower($this->randomMachineName(129));
24     $view['page[create]'] = TRUE;
25     $view['page[path]'] = $this->randomMachineName(255);
26     $view['page[title]'] = $this->randomMachineName(256);
27     $view['page[feed]'] = TRUE;
28     $view['page[feed_properties][path]'] = $this->randomMachineName(255);
29     $view['block[create]'] = TRUE;
30     $view['block[title]'] = $this->randomMachineName(256);
31     $view['rest_export[create]'] = TRUE;
32     $view['rest_export[path]'] = $this->randomMachineName(255);
33
34     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
35
36     $this->assertText('Machine-readable name cannot be longer than 128 characters but is currently 129 characters long.');
37     $this->assertText('Path cannot be longer than 254 characters but is currently 255 characters long.');
38     $this->assertText('Page title cannot be longer than 255 characters but is currently 256 characters long.');
39     $this->assertText('View name cannot be longer than 255 characters but is currently 256 characters long.');
40     $this->assertText('Feed path cannot be longer than 254 characters but is currently 255 characters long.');
41     $this->assertText('Block title cannot be longer than 255 characters but is currently 256 characters long.');
42     $this->assertText('REST export path cannot be longer than 254 characters but is currently 255 characters long.');
43
44     $view['label'] = $this->randomMachineName(255);
45     $view['id'] = strtolower($this->randomMachineName(128));
46     $view['page[create]'] = TRUE;
47     $view['page[path]'] = $this->randomMachineName(254);
48     $view['page[title]'] = $this->randomMachineName(255);
49     $view['page[feed]'] = TRUE;
50     $view['page[feed_properties][path]'] = $this->randomMachineName(254);
51     $view['block[create]'] = TRUE;
52     $view['block[title]'] = $this->randomMachineName(255);
53     $view['rest_export[create]'] = TRUE;
54     $view['rest_export[path]'] = $this->randomMachineName(254);
55
56     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
57     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
58     // Assert that the page title is correctly truncated.
59     $this->assertText(views_ui_truncate($view['page[title]'], 32));
60   }
61
62 }