Namespace
Drupal\Tests\examples\Functional
File
-
tests/src/Functional/ExamplesTest.php
View source
<?php
namespace Drupal\Tests\examples\Functional;
use Drupal\Component\Utility\Html;
use Drupal\Core\Url;
class ExamplesTest extends ExamplesBrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'examples',
'toolbar',
];
public function testExampleToolbar() {
$assert = $this->assertSession();
$this->drupalLogin($this->drupalCreateUser([
'access content',
'access toolbar',
]));
$this->drupalGet('');
$assert->statusCodeEquals(200);
$assert->linkExists('Examples');
$this->assertNotEmpty($this->xpath('//nav/div/a[@data-toolbar-tray="toolbar-item-examples-tray"]'));
$this->assertNotEmpty($this->xpath('//nav/div/div[@data-toolbar-tray="toolbar-item-examples-tray"]'));
$module_installer = $this->container
->get('module_installer');
foreach (_examples_toolbar_routes() as $module => $route) {
$class = Html::getClass($module);
$xpath = "//li/a[@class=\"{$class}\"]";
$this->assertEmpty($this->xpath($xpath), 'Found li with this class: ' . $class);
$module_installer->install([
$module,
], TRUE);
$this->resetAll();
$this->drupalGet(Url::fromRoute($route));
$this->assertNotEmpty($this->xpath($xpath), 'Unable to find toolbar link for module: ' . $module);
if ($module == 'file_example') {
$module_installer->uninstall([
'file_example',
'stream_wrapper_example',
]);
}
}
}
}
Classes
| Title |
Deprecated |
Summary |
| ExamplesTest |
|
Minimal test case for the examples module. |