3 namespace Drupal\views_ui\Tests;
6 * Tests the UI for view duplicate tool.
10 class DuplicateTest extends UITestBase {
12 protected function setUp() {
15 $this->drupalPlaceBlock('page_title_block');
19 * Checks if duplicated view exists and has correct label.
21 public function testDuplicateView() {
23 // Create random view.
24 $random_view = $this->randomView();
26 // Initialize array for duplicated view.
29 // Generate random label and id for new view.
30 $view['label'] = $this->randomMachineName(255);
31 $view['id'] = strtolower($this->randomMachineName(128));
34 $this->drupalPostForm('admin/structure/views/view/' . $random_view['id'] . '/duplicate', $view, t('Duplicate'));
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.');
39 // Assert that the page title is correctly displayed.
40 $this->assertText($view['label']);