X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fuser%2Ftests%2Fsrc%2FKernel%2FUserInstallTest.php;fp=web%2Fcore%2Fmodules%2Fuser%2Ftests%2Fsrc%2FKernel%2FUserInstallTest.php;h=f61811be79ff13bf46aa7eeb0b7be086ed126b9e;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/user/tests/src/Kernel/UserInstallTest.php b/web/core/modules/user/tests/src/Kernel/UserInstallTest.php new file mode 100644 index 000000000..f61811be7 --- /dev/null +++ b/web/core/modules/user/tests/src/Kernel/UserInstallTest.php @@ -0,0 +1,54 @@ +container->get('module_handler')->loadInclude('user', 'install'); + $this->installEntitySchema('user'); + user_install(); + } + + + /** + * Test that the initial users have correct values. + */ + public function testUserInstall() { + $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') + ->fetchAllAssoc('uid'); + $anon = $result[0]; + $admin = $result[1]; + $this->assertFalse(empty($anon->uuid), 'Anon user has a UUID'); + $this->assertFalse(empty($admin->uuid), 'Admin user has a UUID'); + + // Test that the anonymous and administrators languages are equal to the + // site's default language. + $this->assertEqual($anon->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId()); + $this->assertEqual($admin->langcode, \Drupal::languageManager()->getDefaultLanguage()->getId()); + + // Test that the administrator is active. + $this->assertEqual($admin->status, 1); + // Test that the anonymous user is blocked. + $this->assertEqual($anon->status, 0); + } + +}