SystemGetInfoTest.php in Drupal 8
File
core/modules/system/tests/src/Kernel/System/SystemGetInfoTest.php
View source
<?php
namespace Drupal\Tests\system\Kernel\System;
use Drupal\KernelTests\KernelTestBase;
class SystemGetInfoTest extends KernelTestBase {
public static $modules = [
'system',
];
public function testSystemGetInfo() {
$system_module_info = system_get_info('module', 'system');
$this
->assertSame('System', $system_module_info['name']);
$this
->assertSame([
'path_alias' => system_get_info('module', 'path_alias'),
'system' => $system_module_info,
], system_get_info('module'));
$this
->assertSame([], system_get_info('module', 'user'));
$this->container
->get('module_installer')
->install([
'user',
]);
$user_module_info = system_get_info('module', 'user');
$this
->assertSame('User', $user_module_info['name']);
$this
->assertSame([
'path_alias' => system_get_info('module', 'path_alias'),
'system' => $system_module_info,
'user' => $user_module_info,
], system_get_info('module'));
$this
->assertSame([], system_get_info('theme', 'stable'));
$this
->assertSame([], system_get_info('theme'));
$this->container
->get('theme_installer')
->install([
'stable',
]);
$stable_theme_info = system_get_info('theme', 'stable');
$this
->assertSame('Stable', $stable_theme_info['name']);
$this
->assertSame([
'stable' => $stable_theme_info,
], system_get_info('theme'));
}
}