3 namespace Drupal\Tests\system\Kernel\System;
5 use Drupal\KernelTests\KernelTestBase;
8 * Tests system_get_info().
12 class SystemGetInfoTest extends KernelTestBase {
14 public static $modules = ['system'];
17 * Tests system_get_info().
19 public function testSystemGetInfo() {
20 $system_module_info = system_get_info('module', 'system');
21 $this->assertSame('System', $system_module_info['name']);
22 $this->assertSame(['system' => $system_module_info], system_get_info('module'));
24 // The User module is not installed so system_get_info() should return
26 $this->assertSame([], system_get_info('module', 'user'));
28 // Install the User module and check system_get_info() returns the correct
30 $this->container->get('module_installer')->install(['user']);
31 $user_module_info = system_get_info('module', 'user');
32 $this->assertSame('User', $user_module_info['name']);
33 $this->assertSame(['system' => $system_module_info, 'user' => $user_module_info], system_get_info('module'));
35 // Test theme info. There are no themes installed yet.
36 $this->assertSame([], system_get_info('theme', 'stable'));
37 $this->assertSame([], system_get_info('theme'));
38 $this->container->get('theme_installer')->install(['stable']);
39 $stable_theme_info = system_get_info('theme', 'stable');
40 $this->assertSame('Stable', $stable_theme_info['name']);
41 $this->assertSame(['stable' => $stable_theme_info], system_get_info('theme'));