3 namespace Drupal\Tests\user\Kernel;
5 use Drupal\KernelTests\KernelTestBase;
8 * Tests user_install().
12 class UserInstallTest extends KernelTestBase {
19 public static $modules = ['user'];
24 protected function setUp() {
26 $this->container->get('module_handler')->loadInclude('user', 'install');
27 $this->installEntitySchema('user');
32 * Test that the initial users have correct values.
34 public function testUserInstall() {
35 $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')
36 ->fetchAllAssoc('uid');
39 $this->assertFalse(empty($anon->uuid), 'Anon user has a UUID');
40 $this->assertFalse(empty($admin->uuid), 'Admin user has a UUID');
42 // Test that the anonymous and administrators languages are equal to the
43 // site's default language.
44 $this->assertEqual($anon->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId());
45 $this->assertEqual($admin->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId());
47 // Test that the administrator is active.
48 $this->assertEqual($admin->status, 1);
49 // Test that the anonymous user is blocked.
50 $this->assertEqual($anon->status, 0);