Namespace
Drupal\Tests\tabledrag_example\Functional
File
-
modules/tabledrag_example/tests/src/Functional/TabledragMenuTest.php
View source
<?php
namespace Drupal\Tests\tabledrag_example\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class TabledragMenuTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'tabledrag_example',
];
protected $profile = 'minimal';
public function testTabledragInteractions() {
$links = [
'examples/tabledrag-example',
'examples/tabledrag-example/row',
'examples/tabledrag-example/nested',
'examples/tabledrag-example/roots-and-leaves',
'examples/tabledrag-example/reset',
];
$this->drupalLogin($this->createUser([
'access content',
]));
$assertion = $this->assertSession();
$this->drupalGet('');
foreach ($links as $path) {
$assertion->linkByHrefExists($path);
}
foreach ($links as $path) {
$this->drupalGet($path);
$assertion->statusCodeEquals(200);
}
$pages = [
'tabledrag_example.simple_form' => [
'Save All Changes',
'Cancel',
],
'tabledrag_example.parent_form' => [
'Save All Changes',
'Cancel',
],
'tabledrag_example.rootleaf_form' => [
'Save All Changes',
'Cancel',
],
'tabledrag_example.reset_form' => [
'Yes, Reset It!',
],
];
foreach ($pages as $route => $buttons) {
$path = Url::fromRoute($route);
foreach ($buttons as $button) {
$this->drupalGet($path);
$this->submitForm([], $button);
$assertion->statusCodeEquals(200);
}
}
$this->drupalGet(Url::fromRoute('tabledrag_example.reset_form'));
$this->clickLink('Cancel');
$assertion->statusCodeEquals(200);
}
}
Classes
| Title |
Deprecated |
Summary |
| TabledragMenuTest |
|
Verify functionalities of tabledrag_example. |