blob: 290f87fbe7ee5d4d5b98192bd1d3fdc00efcd527 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class UserProcedureTest extends BaseProcedureTest
{
public function testAll()
{
$this->assertCreateUser();
$this->assertGetUserById();
$this->assertGetUserByName();
$this->assertGetAllUsers();
$this->assertEnableDisableUser();
$this->assertUpdateUser();
$this->assertRemoveUser();
}
public function assertGetUserById()
{
$user = $this->app->getUser($this->userId);
$this->assertNotNull($user);
$this->assertEquals($this->username, $user['username']);
}
public function assertGetUserByName()
{
$user = $this->app->getUserByName($this->username);
$this->assertNotNull($user);
$this->assertEquals($this->username, $user['username']);
}
public function assertGetAllUsers()
{
$users = $this->app->getAllUsers();
$this->assertInternalType('array', $users);
$this->assertNotEmpty($users);
}
public function assertEnableDisableUser()
{
$this->assertTrue($this->app->disableUser($this->userId));
$this->assertFalse($this->app->isActiveUser($this->userId));
$this->assertTrue($this->app->enableUser($this->userId));
$this->assertTrue($this->app->isActiveUser($this->userId));
}
public function assertUpdateUser()
{
$this->assertTrue($this->app->updateUser(array(
'id' => $this->userId,
'name' => 'My user',
)));
$user = $this->app->getUser($this->userId);
$this->assertNotNull($user);
$this->assertEquals('My user', $user['name']);
}
public function assertRemoveUser()
{
$this->assertTrue($this->app->removeUser($this->userId));
}
}
|