class RouteProcessorManagerTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
- 10 core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
- 9 core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
- 8.9.x core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
Tests Drupal\Core\RouteProcessor\RouteProcessorManager.
Attributes
#[CoversClass(RouteProcessorManager::class)]
#[Group('RouteProcessor')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of RouteProcessorManagerTest
File
-
core/
tests/ Drupal/ Tests/ Core/ RouteProcessor/ RouteProcessorManagerTest.php, line 19
Namespace
Drupal\Tests\Core\RouteProcessorView source
class RouteProcessorManagerTest extends UnitTestCase {
/**
* Tests the Route process manager functionality.
*/
public function testRouteProcessorManager() : void {
$route = new Route('');
$parameters = [
'test' => 'test',
];
$route_name = 'test_name';
$processorManager = new RouteProcessorManager([
$this->getMockProcessor($route_name, $route, $parameters),
$this->getMockProcessor($route_name, $route, $parameters),
$this->getMockProcessor($route_name, $route, $parameters),
]);
$bubbleable_metadata = new BubbleableMetadata();
$processorManager->processOutbound($route_name, $route, $parameters, $bubbleable_metadata);
// Default cacheability is: permanently cacheable, no cache tags/contexts.
$this->assertEquals((new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT), $bubbleable_metadata);
}
/**
* Returns a mock Route processor object.
*
* @param string $route_name
* The route name.
* @param \Symfony\Component\Routing\Route $route
* The Route to use in mock with() expectation.
* @param array $parameters
* The parameters to use in mock with() expectation.
*
* @return \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface|\PHPUnit\Framework\MockObject\MockObject
* The mock processor object.
*/
protected function getMockProcessor($route_name, $route, $parameters) : MockObject {
$processor = $this->createMock('Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface');
$processor->expects($this->once())
->method('processOutbound')
->with($route_name, $route, $parameters);
return $processor;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|
| DrupalTestCaseTrait::checkErrorHandlerOnTearDown | public | function | Checks the test error handler after test execution. | 1 |
| RandomGeneratorTrait::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | |
| RandomGeneratorTrait::randomMachineName | protected | function | Generates a unique random string containing letters and numbers. | |
| RandomGeneratorTrait::randomObject | public | function | Generates a random PHP object. | |
| RandomGeneratorTrait::randomString | public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
| RouteProcessorManagerTest::getMockProcessor | protected | function | Returns a mock Route processor object. | |
| RouteProcessorManagerTest::testRouteProcessorManager | public | function | Tests the Route process manager functionality. | |
| UnitTestCase::$root | protected | property | The app root. | |
| UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | |
| UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | |
| UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | |
| UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | |
| UnitTestCase::setDebugDumpHandler | public static | function | Registers the dumper CLI handler when the DebugDump extension is enabled. | |
| UnitTestCase::setupMockIterator | protected | function | Set up a traversable class mock to return specific items when iterated. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.