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');
33 * Test that the initial users have correct values.
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');
40 $this->assertFalse(empty($anon->uuid), 'Anon user has a UUID');
41 $this->assertFalse(empty($admin->uuid), 'Admin user has a UUID');
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());
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);