class DuplicateTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views_ui/tests/src/Functional/DuplicateTest.php \Drupal\Tests\views_ui\Functional\DuplicateTest
- 9 core/modules/views_ui/tests/src/Functional/DuplicateTest.php \Drupal\Tests\views_ui\Functional\DuplicateTest
Tests the UI for view duplicate tool.
@group views_ui
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views_ui\Functional\DuplicateTest
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of DuplicateTest
File
- core/
modules/ views_ui/ tests/ src/ Functional/ DuplicateTest.php, line 10
Namespace
Drupal\Tests\views_ui\FunctionalView source
class DuplicateTest extends UITestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
protected function setUp($import_test_views = TRUE, $modules = [
'views_test_config',
]) : void {
parent::setUp($import_test_views, $modules);
$this
->placeBlock('page_title_block');
}
/**
* Checks if duplicated view exists and has correct label.
*/
public function testDuplicateView() {
// Create random view.
$random_view = $this
->randomView();
// Initialize array for duplicated view.
$view = [];
// Generate random label and id for new view.
$view['label'] = $this
->randomMachineName(255);
$view['id'] = strtolower($this
->randomMachineName(128));
// Duplicate view.
$this
->drupalGet('admin/structure/views/view/' . $random_view['id'] . '/duplicate');
$this
->submitForm($view, 'Duplicate');
// Assert that the page url is correct.
$this
->assertSession()
->addressEquals('admin/structure/views/view/' . $view['id']);
// Assert that the page title is correctly displayed.
$this
->assertSession()
->pageTextContains($view['label']);
}
}