diff options
Diffstat (limited to 'tests/integration/GroupMemberProcedureTest.php')
-rw-r--r-- | tests/integration/GroupMemberProcedureTest.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/integration/GroupMemberProcedureTest.php b/tests/integration/GroupMemberProcedureTest.php new file mode 100644 index 00000000..fe243533 --- /dev/null +++ b/tests/integration/GroupMemberProcedureTest.php @@ -0,0 +1,53 @@ +<?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)); + } +} |