class RouteProcessorManagerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
@coversDefaultClass \Drupal\Core\RouteProcessor\RouteProcessorManager @group RouteProcessor
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest
Expanded class hierarchy of RouteProcessorManagerTest
File
- core/
tests/ Drupal/ Tests/ Core/ RouteProcessor/ RouteProcessorManagerTest.php, line 20 - Contains \Drupal\Tests\Core\RouteProcessor\RouteProcessorManagerTest.
Namespace
Drupal\Tests\Core\RouteProcessorView source
class RouteProcessorManagerTest extends UnitTestCase {
/**
* The route processor manager.
*
* @var \Drupal\Core\RouteProcessor\RouteProcessorManager
*/
protected $processorManager;
protected function setUp() {
$this->processorManager = new RouteProcessorManager();
}
/**
* Tests the Route process manager functionality.
*/
public function testRouteProcessorManager() {
$route = new Route('');
$parameters = array(
'test' => 'test',
);
$route_name = 'test_name';
$processors = array(
10 => $this
->getMockProcessor($route_name, $route, $parameters),
5 => $this
->getMockProcessor($route_name, $route, $parameters),
0 => $this
->getMockProcessor($route_name, $route, $parameters),
);
// Add the processors in reverse order.
foreach ($processors as $priority => $processor) {
$this->processorManager
->addOutbound($processor, $priority);
}
$bubbleable_metadata = new BubbleableMetadata();
$this->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
*/
protected function getMockProcessor($route_name, $route, $parameters) {
$processor = $this
->getMock('Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface');
$processor
->expects($this
->once())
->method('processOutbound')
->with($route_name, $route, $parameters);
return $processor;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteProcessorManagerTest:: |
protected | property | The route processor manager. | |
RouteProcessorManagerTest:: |
protected | function | Returns a mock Route processor object. | |
RouteProcessorManagerTest:: |
protected | function |
Overrides UnitTestCase:: |
|
RouteProcessorManagerTest:: |
public | function | Tests the Route process manager functionality. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in 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. |