class LocalTasksTest in Twitter Profile Widget 8
Tests whether Twitter Profile Widget local tasks work correctly.
@group twitter_profile_widget
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase
- class \Drupal\Tests\twitter_profile_widget\Unit\Menu\LocalTasksTest
- class \Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase
Expanded class hierarchy of LocalTasksTest
File
- tests/
src/ Unit/ Menu/ LocalTasksTest.php, line 12
Namespace
Drupal\Tests\twitter_profile_widget\Unit\MenuView source
class LocalTasksTest extends LocalTaskIntegrationTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
// Set the path of the module dynamically.
$module_path = str_replace(\Drupal::root(), '', __DIR__);
$module_path = str_replace('tests/src/Unit/Menu', '', $module_path);
$module_path = trim($module_path, '/');
$this->directoryList = [
'twitter_profile_widget' => $module_path,
];
}
/**
* Tests whether the server's local tasks are present at the given route.
*
* @param string $route
* The route to test.
*
* @dataProvider getPageRoutesEntity
*/
public function testLocalTasksEntity($route) {
$tasks = [
0 => [
'entity.twitter_widget.canonical',
'entity.twitter_widget.edit_form',
'entity.twitter_widget.delete_form',
],
];
$this
->assertLocalTasks($route, $tasks);
}
/**
* Provides a list of routes to test.
*
* @return array[]
* An array containing arrays with the arguments for a
* testLocalTasksEntity() call.
*/
public function getPageRoutesEntity() {
return [
[
'entity.twitter_widget.canonical',
],
[
'entity.twitter_widget.edit_form',
],
[
'entity.twitter_widget.delete_form',
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LocalTaskIntegrationTestBase:: |
protected | property | The container. | |
LocalTaskIntegrationTestBase:: |
protected | property | A list of module directories used for YAML searching. | |
LocalTaskIntegrationTestBase:: |
protected | property | The module handler. | |
LocalTaskIntegrationTestBase:: |
protected | function | Tests integration for local tasks. | |
LocalTaskIntegrationTestBase:: |
protected | function | Sets up the local task manager for the test. | |
LocalTasksTest:: |
public | function | Provides a list of routes to test. | |
LocalTasksTest:: |
public | function |
Overrides LocalTaskIntegrationTestBase:: |
|
LocalTasksTest:: |
public | function | Tests whether the server's local tasks are present at the given route. | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |