-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from silinternational/feature/smarter-listMembers
Add some query logic for roles into members.listMembers
- Loading branch information
Showing
2 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ public function testInsert() | |
|
||
$member = new GoogleDirectory_Member(); | ||
$member->setEmail($emailAddress); | ||
$member->setRole('MEMBER'); | ||
|
||
$mockGoogleServiceDirectory = new GoogleMock_Directory('anyclient', $this->dataFile); | ||
try { | ||
|
@@ -72,7 +73,7 @@ public function testHasMember() | |
self::assertTrue($hasMember); | ||
} | ||
|
||
public function testListMembers() | ||
public function testListMembersAll() | ||
{ | ||
$groupEmailAddress = '[email protected]'; | ||
$mockGoogleServiceDirectory = new GoogleMock_Directory('anyclient', $this->dataFile); | ||
|
@@ -88,8 +89,60 @@ public function testListMembers() | |
); | ||
} | ||
self::assertNotEmpty( | ||
$members, | ||
'Was expecting the members.list method to have at least one member.' | ||
$members->getMembers(), | ||
'Was expecting the members.list method to have at least one member entry.' | ||
); | ||
} | ||
|
||
public function testListMembersOnlyMember() | ||
{ | ||
$groupEmailAddress = '[email protected]'; | ||
$mockGoogleServiceDirectory = new GoogleMock_Directory('anyclient', $this->dataFile); | ||
$members = []; | ||
try { | ||
$members = $mockGoogleServiceDirectory->members->listMembers( | ||
$groupEmailAddress, | ||
[ | ||
'query' => 'roles=MEMBER' | ||
] | ||
); | ||
} catch (Exception $exception) { | ||
self::fail( | ||
sprintf( | ||
'Was expecting the members.list method to function, but got: %s', | ||
$exception->getMessage() | ||
) | ||
); | ||
} | ||
self::assertNotEmpty( | ||
$members->getMembers(), | ||
'Was expecting the members.list method to have at least one member type entry.' | ||
); | ||
} | ||
|
||
public function testListMembersOnlyOwner() | ||
{ | ||
$groupEmailAddress = '[email protected]'; | ||
$mockGoogleServiceDirectory = new GoogleMock_Directory('anyclient', $this->dataFile); | ||
$members = []; | ||
try { | ||
$members = $mockGoogleServiceDirectory->members->listMembers( | ||
$groupEmailAddress, | ||
[ | ||
'query' => 'roles=OWNER' | ||
] | ||
); | ||
} catch (Exception $exception) { | ||
self::fail( | ||
sprintf( | ||
'Was expecting the members.list method to function, but got: %s', | ||
$exception->getMessage() | ||
) | ||
); | ||
} | ||
self::assertEmpty( | ||
$members->getMembers(), | ||
'Was expecting the members.list method to have no owner types.' | ||
); | ||
} | ||
} |