Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / src / Kernel / System / SystemGetInfoTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Kernel\System;
4
5 use Drupal\KernelTests\KernelTestBase;
6
7 /**
8  * Tests system_get_info().
9  *
10  * @group system
11  */
12 class SystemGetInfoTest extends KernelTestBase {
13
14   public static $modules = ['system'];
15
16   /**
17    * Tests system_get_info().
18    */
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'));
23
24     // The User module is not installed so system_get_info() should return
25     // an empty array.
26     $this->assertSame([], system_get_info('module', 'user'));
27
28     // Install the User module and check system_get_info() returns the correct
29     // information.
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'));
34
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'));
42   }
43
44 }