File size: 1,658 Bytes
e4f4821 |
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 |
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class GroupMemberProcedureTest extends BaseProcedureTest
{
protected $username = 'user-group-member';
protected $groupName1 = 'My group member A';
protected $groupName2 = 'My group member B';
public function testAll()
{
$this->assertCreateGroups();
$this->assertCreateUser();
$this->assertAddMember();
$this->assertGetMembers();
$this->assertIsGroupMember();
$this->assertGetGroups();
$this->assertRemove();
}
public function assertAddMember()
{
$this->assertTrue($this->app->addGroupMember($this->groupId1, $this->userId));
}
public function assertGetMembers()
{
$members = $this->app->getGroupMembers($this->groupId1);
$this->assertCount(1, $members);
$this->assertEquals($this->username, $members[0]['username']);
}
public function assertIsGroupMember()
{
$this->assertTrue($this->app->isGroupMember($this->groupId1, $this->userId));
$this->assertFalse($this->app->isGroupMember($this->groupId1, $this->adminUserId));
}
public function assertGetGroups()
{
$groups = $this->app->getMemberGroups($this->userId);
$this->assertCount(1, $groups);
$this->assertEquals($this->groupId1, $groups[0]['id']);
$this->assertEquals($this->groupName1, $groups[0]['name']);
}
public function assertRemove()
{
$this->assertTrue($this->app->removeGroupMember($this->groupId1, $this->userId));
$this->assertFalse($this->app->isGroupMember($this->groupId1, $this->userId));
}
}
|