function ForumBreadcrumbBuilderBaseTest::testConstructor
Same name in other branches
- 9 core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumBreadcrumbBuilderBaseTest::testConstructor()
- 8.9.x core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumBreadcrumbBuilderBaseTest::testConstructor()
- 11.x core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php \Drupal\Tests\forum\Unit\Breadcrumb\ForumBreadcrumbBuilderBaseTest::testConstructor()
Tests ForumBreadcrumbBuilderBase::__construct().
@covers ::__construct
File
-
core/
modules/ forum/ tests/ src/ Unit/ Breadcrumb/ ForumBreadcrumbBuilderBaseTest.php, line 40
Class
- ForumBreadcrumbBuilderBaseTest
- @coversDefaultClass \Drupal\forum\Breadcrumb\ForumBreadcrumbBuilderBase @group forum @group legacy
Namespace
Drupal\Tests\forum\Unit\BreadcrumbCode
public function testConstructor() : void {
// Make some test doubles.
$entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
$config_factory = $this->getConfigFactoryStub([
'forum.settings' => [
'IAmATestKey' => 'IAmATestValue',
],
]);
$forum_manager = $this->createMock('Drupal\\forum\\ForumManagerInterface');
$translation_manager = $this->createMock('Drupal\\Core\\StringTranslation\\TranslationInterface');
// Make an object to test.
$builder = $this->getMockForAbstractClass('Drupal\\forum\\Breadcrumb\\ForumBreadcrumbBuilderBase', [
$entity_type_manager,
$config_factory,
$forum_manager,
$translation_manager,
]);
// Test that the constructor made a config object with our info in it.
$reflector = new \ReflectionClass($builder);
$ref_property = $reflector->getProperty('config');
$config = $ref_property->getValue($builder);
$this->assertEquals('IAmATestValue', $config->get('IAmATestKey'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.