summaryrefslogtreecommitdiff
path: root/tests/integration/GroupMemberTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/GroupMemberTest.php')
-rw-r--r--tests/integration/GroupMemberTest.php56
1 files changed, 31 insertions, 25 deletions
diff --git a/tests/integration/GroupMemberTest.php b/tests/integration/GroupMemberTest.php
index d49945b5..f79499a4 100644
--- a/tests/integration/GroupMemberTest.php
+++ b/tests/integration/GroupMemberTest.php
@@ -1,47 +1,53 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/BaseIntegrationTest.php';
-class GroupMemberTest extends Base
+class GroupMemberTest extends BaseIntegrationTest
{
- public function testAddMember()
+ protected $username = 'user-group-member';
+ protected $groupName1 = 'My group member A';
+ protected $groupName2 = 'My group member B';
+
+ public function testAll()
{
- $this->assertNotFalse($this->app->createGroup('My Group A'));
- $this->assertNotFalse($this->app->createGroup('My Group B'));
+ $this->assertCreateGroups();
+ $this->assertCreateUser();
+ $this->assertAddMember();
+ $this->assertGetMembers();
+ $this->assertIsGroupMember();
+ $this->assertGetGroups();
+ $this->assertRemove();
+ }
- $groupId = $this->getGroupId();
- $this->assertTrue($this->app->addGroupMember($groupId, 1));
+ public function assertAddMember()
+ {
+ $this->assertTrue($this->app->addGroupMember($this->groupId1, $this->userId));
}
- public function testGetMembers()
+ public function assertGetMembers()
{
- $groups = $this->app->getAllGroups();
- $members = $this->app->getGroupMembers($groups[0]['id']);
+ $members = $this->app->getGroupMembers($this->groupId1);
$this->assertCount(1, $members);
- $this->assertEquals('admin', $members[0]['username']);
-
- $this->assertSame(array(), $this->app->getGroupMembers($groups[1]['id']));
+ $this->assertEquals($this->username, $members[0]['username']);
}
- public function testIsGroupMember()
+ public function assertIsGroupMember()
{
- $groupId = $this->getGroupId();
- $this->assertTrue($this->app->isGroupMember($groupId, 1));
- $this->assertFalse($this->app->isGroupMember($groupId, 2));
+ $this->assertTrue($this->app->isGroupMember($this->groupId1, $this->userId));
+ $this->assertFalse($this->app->isGroupMember($this->groupId1, $this->adminUserId));
}
- public function testGetGroups()
+ public function assertGetGroups()
{
- $groups = $this->app->getMemberGroups(1);
+ $groups = $this->app->getMemberGroups($this->userId);
$this->assertCount(1, $groups);
- $this->assertEquals(1, $groups[0]['id']);
- $this->assertEquals('My Group A', $groups[0]['name']);
+ $this->assertEquals($this->groupId1, $groups[0]['id']);
+ $this->assertEquals($this->groupName1, $groups[0]['name']);
}
- public function testRemove()
+ public function assertRemove()
{
- $groupId = $this->getGroupId();
- $this->assertTrue($this->app->removeGroupMember($groupId, 1));
- $this->assertFalse($this->app->isGroupMember($groupId, 1));
+ $this->assertTrue($this->app->removeGroupMember($this->groupId1, $this->userId));
+ $this->assertFalse($this->app->isGroupMember($this->groupId1, $this->userId));
}
}