public function ForumNodeBreadcrumbBuilderTest::testApplies in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest::testApplies()
Tests ForumNodeBreadcrumbBuilder::applies().
@dataProvider providerTestApplies @covers ::applies
Parameters
bool $expected: ForumNodeBreadcrumbBuilder::applies() expected result.
string|null $route_name: (optional) A route name.
array $parameter_map: (optional) An array of parameter names and values.
File
- core/
modules/ forum/ tests/ src/ Unit/ Breadcrumb/ ForumNodeBreadcrumbBuilderTest.php, line 49 - Contains \Drupal\Tests\forum\Unit\Breadcrumb\ForumNodeBreadcrumbBuilderTest.
Class
- ForumNodeBreadcrumbBuilderTest
- @coversDefaultClass \Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder @group forum
Namespace
Drupal\Tests\forum\Unit\BreadcrumbCode
public function testApplies($expected, $route_name = NULL, $parameter_map = array()) {
// Make some test doubles.
$entity_manager = $this
->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$config_factory = $this
->getConfigFactoryStub(array());
$forum_manager = $this
->getMock('Drupal\\forum\\ForumManagerInterface');
$forum_manager
->expects($this
->any())
->method('checkNodeType')
->will($this
->returnValue(TRUE));
// Make an object to test.
$builder = $this
->getMockBuilder('Drupal\\forum\\Breadcrumb\\ForumNodeBreadcrumbBuilder')
->setConstructorArgs(array(
$entity_manager,
$config_factory,
$forum_manager,
))
->setMethods(NULL)
->getMock();
$route_match = $this
->getMock('Drupal\\Core\\Routing\\RouteMatchInterface');
$route_match
->expects($this
->once())
->method('getRouteName')
->will($this
->returnValue($route_name));
$route_match
->expects($this
->any())
->method('getParameter')
->will($this
->returnValueMap($parameter_map));
$this
->assertEquals($expected, $builder
->applies($route_match));
}