public function UserInstallTest::testUserInstall in Drupal 8
Same name and namespace in other branches
- 9 core/modules/user/tests/src/Kernel/UserInstallTest.php \Drupal\Tests\user\Kernel\UserInstallTest::testUserInstall()
- 10 core/modules/user/tests/src/Kernel/UserInstallTest.php \Drupal\Tests\user\Kernel\UserInstallTest::testUserInstall()
Test that the initial users have correct values.
File
- core/
modules/ user/ tests/ src/ Kernel/ UserInstallTest.php, line 34
Class
- UserInstallTest
- Tests user_install().
Namespace
Drupal\Tests\user\KernelCode
public function testUserInstall() {
$user_ids = \Drupal::entityQuery('user')
->sort('uid')
->execute();
$users = \Drupal::entityTypeManager()
->getStorage('user')
->loadMultiple($user_ids);
$anon = $users[0];
$admin = $users[1];
$this
->assertNotEmpty($anon
->uuid(), 'Anon user has a UUID');
$this
->assertNotEmpty($admin
->uuid(), 'Admin user has a UUID');
// Test that the anonymous and administrators languages are equal to the
// site's default language.
$this
->assertEquals('en', $anon
->language()
->getId());
$this
->assertEquals('en', $admin
->language()
->getId());
// Test that the administrator is active.
$this
->assertTrue($admin
->isActive());
// Test that the anonymous user is blocked.
$this
->assertTrue($anon
->isBlocked());
}