DuplicateTest.php in Drupal 9
File
core/modules/views_ui/tests/src/Functional/DuplicateTest.php
View source
<?php
namespace Drupal\Tests\views_ui\Functional;
class DuplicateTest extends UITestBase {
protected $defaultTheme = 'stark';
protected function setUp($import_test_views = TRUE) : void {
parent::setUp($import_test_views);
$this
->placeBlock('page_title_block');
}
public function testDuplicateView() {
$random_view = $this
->randomView();
$view = [];
$view['label'] = $this
->randomMachineName(255);
$view['id'] = strtolower($this
->randomMachineName(128));
$this
->drupalGet('admin/structure/views/view/' . $random_view['id'] . '/duplicate');
$this
->submitForm($view, 'Duplicate');
$this
->assertSession()
->addressEquals('admin/structure/views/view/' . $view['id']);
$this
->assertSession()
->pageTextContains($view['label']);
}
}