UserInstallTest.php in Drupal 8
File
core/modules/user/tests/src/Kernel/UserInstallTest.php
View source
<?php
namespace Drupal\Tests\user\Kernel;
use Drupal\KernelTests\KernelTestBase;
class UserInstallTest extends KernelTestBase {
public static $modules = [
'user',
];
protected function setUp() {
parent::setUp();
$this->container
->get('module_handler')
->loadInclude('user', 'install');
$this
->installEntitySchema('user');
user_install();
}
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');
$this
->assertEquals('en', $anon
->language()
->getId());
$this
->assertEquals('en', $admin
->language()
->getId());
$this
->assertTrue($admin
->isActive());
$this
->assertTrue($anon
->isBlocked());
}
}