-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUsersTest.php
More file actions
47 lines (39 loc) · 1.04 KB
/
UsersTest.php
File metadata and controls
47 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Drupal\Tests\trustee_profile\Kernel\Plugin\InstallTask;
use Drupal\KernelTests\KernelTestBase;
use Drupal\trustee_profile\Plugin\InstallTask\Users;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
/**
* Class UsersTest.
*/
class UsersTest extends KernelTestBase {
/**
* {@inheritDoc}
*/
protected static $modules = [
'system',
'user',
];
/**
* {@inheritDoc}
*/
public function setup(): void {
parent::setUp();
$this->setInstallProfile('trustee_profile');
$this->installEntitySchema('user');
$this->installEntitySchema('user_role');
$this->installSchema('system', ['sequences']);
Role::create(['label' => 'Owner', 'id' => "site_manager"])->save();
}
/**
* The correct number of users should be created.
*/
public function testUsers() {
User::create(['name' => 'admin'])->save();
$user_plugin = Users::create($this->container, [], '', []);
$install_state = [];
$user_plugin->runTask($install_state);
$this->assertCount(1, User::loadMultiple());
}
}