Mercurial > hg > isophonics-drupal-site
comparison core/modules/user/tests/src/Kernel/UserInstallTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\user\Kernel; | |
4 | |
5 use Drupal\KernelTests\KernelTestBase; | |
6 | |
7 /** | |
8 * Tests user_install(). | |
9 * | |
10 * @group user | |
11 */ | |
12 class UserInstallTest extends KernelTestBase { | |
13 | |
14 /** | |
15 * Modules to enable. | |
16 * | |
17 * @var array | |
18 */ | |
19 public static $modules = ['user']; | |
20 | |
21 /** | |
22 * {@inheritdoc} | |
23 */ | |
24 protected function setUp() { | |
25 parent::setUp(); | |
26 $this->container->get('module_handler')->loadInclude('user', 'install'); | |
27 $this->installEntitySchema('user'); | |
28 user_install(); | |
29 } | |
30 | |
31 | |
32 /** | |
33 * Test that the initial users have correct values. | |
34 */ | |
35 public function testUserInstall() { | |
36 $result = db_query('SELECT u.uid, u.uuid, u.langcode, uf.status FROM {users} u INNER JOIN {users_field_data} uf ON u.uid=uf.uid ORDER BY u.uid') | |
37 ->fetchAllAssoc('uid'); | |
38 $anon = $result[0]; | |
39 $admin = $result[1]; | |
40 $this->assertFalse(empty($anon->uuid), 'Anon user has a UUID'); | |
41 $this->assertFalse(empty($admin->uuid), 'Admin user has a UUID'); | |
42 | |
43 // Test that the anonymous and administrators languages are equal to the | |
44 // site's default language. | |
45 $this->assertEqual($anon->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId()); | |
46 $this->assertEqual($admin->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId()); | |
47 | |
48 // Test that the administrator is active. | |
49 $this->assertEqual($admin->status, 1); | |
50 // Test that the anonymous user is blocked. | |
51 $this->assertEqual($anon->status, 0); | |
52 } | |
53 | |
54 } |