From 922e0fb6de06a98774418612e0b0f75af72b6dbb Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 25 Jun 2016 14:34:46 -0400 Subject: Rewrite integration tests to run with Docker containers --- tests/integration/GroupMemberTest.php | 56 +++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'tests/integration/GroupMemberTest.php') 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 @@ 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)); } } -- cgit v1.2.3