public function ComponentsInfoTest::testGetModuleInfo in Components! 8.2
Tests retrieving components info from a module.
@covers ::getModuleInfo
File
- tests/
src/ Unit/ ComponentsInfoTest.php, line 259
Class
- ComponentsInfoTest
- @coversDefaultClass \Drupal\components\Template\ComponentsInfo @group components
Namespace
Drupal\Tests\components\UnitCode
public function testGetModuleInfo() {
$this->moduleExtensionList
->expects($this
->exactly(1))
->method('getAllInstalledInfo')
->willReturn([
'foo' => [
'name' => 'Foo',
'type' => 'module',
'components' => [
'included' => 'foo',
],
],
'bar' => [
'name' => 'Bar',
'type' => 'module',
'components' => [
'included' => 'bar',
],
],
]);
$this->moduleExtensionList
->expects($this
->exactly(2))
->method('getPath')
->willReturn($this->modulesDir . '/foo', $this->modulesDir . '/bar');
$this->themeExtensionList
->method('getAllInstalledInfo')
->willReturn([]);
$this
->newSystemUnderTest();
$expected = [
'included' => 'bar',
'extensionPath' => $this->modulesDir . '/bar',
];
$result = $this->systemUnderTest
->getModuleInfo('bar');
$this
->assertEquals($expected, $result);
}