Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / DuplicateTest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 /**
6  * Tests the UI for view duplicate tool.
7  *
8  * @group views_ui
9  */
10 class DuplicateTest extends UITestBase {
11
12   protected function setUp($import_test_views = TRUE) {
13     parent::setUp($import_test_views);
14
15     $this->placeBlock('page_title_block');
16   }
17
18   /**
19    * Checks if duplicated view exists and has correct label.
20    */
21   public function testDuplicateView() {
22
23     // Create random view.
24     $random_view = $this->randomView();
25
26     // Initialize array for duplicated view.
27     $view = [];
28
29     // Generate random label and id for new view.
30     $view['label'] = $this->randomMachineName(255);
31     $view['id'] = strtolower($this->randomMachineName(128));
32
33     // Duplicate view.
34     $this->drupalPostForm('admin/structure/views/view/' . $random_view['id'] . '/duplicate', $view, t('Duplicate'));
35
36     // Assert that the page url is correct.
37     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
38
39     // Assert that the page title is correctly displayed.
40     $this->assertText($view['label']);
41   }
42
43 }