class BookLocalTasksTest
Tests existence of book local tasks.
@group book
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase implements \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\book\Unit\Menu\BookLocalTasksTest implements \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase implements \Drupal\Tests\UnitTestCase
Expanded class hierarchy of BookLocalTasksTest
File
-
core/
modules/ book/ tests/ src/ Unit/ Menu/ BookLocalTasksTest.php, line 12
Namespace
Drupal\Tests\book\Unit\MenuView source
class BookLocalTasksTest extends LocalTaskIntegrationTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
$this->directoryList = [
'book' => 'core/modules/book',
'node' => 'core/modules/node',
];
parent::setUp();
}
/**
* Tests local task existence.
*
* @dataProvider getBookAdminRoutes
*/
public function testBookAdminLocalTasks($route) {
$this->assertLocalTasks($route, [
0 => [
'book.admin',
'book.settings',
],
]);
}
/**
* Provides a list of routes to test.
*/
public function getBookAdminRoutes() {
return [
[
'book.admin',
],
[
'book.settings',
],
];
}
/**
* Tests local task existence.
*
* @dataProvider getBookNodeRoutes
*/
public function testBookNodeLocalTasks($route) {
$this->assertLocalTasks($route, [
0 => [
'entity.node.book_outline_form',
'entity.node.canonical',
'entity.node.edit_form',
'entity.node.delete_form',
'entity.node.version_history',
],
]);
}
/**
* Provides a list of routes to test.
*/
public function getBookNodeRoutes() {
return [
[
'entity.node.canonical',
],
[
'entity.node.book_outline_form',
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.