3 namespace Drupal\views_ui\Tests;
5 use Drupal\views\Tests\Wizard\WizardTestBase;
11 * @see \Drupal\views\Plugin\views\display\DisplayPluginBase
12 * @see \Drupal\views\Plugin\views\display\PathPluginBase
13 * @see \Drupal\views\Plugin\views\wizard\WizardPluginBase
15 class WizardTest extends WizardTestBase {
18 * Tests filling in the wizard with really long strings.
20 public function testWizardFieldLength() {
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);
34 $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
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.');
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);
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));