File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
lib/Github/Api/Organization
test/Github/Tests/Api/Organization Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ public function conceal($organization, $username)
4646 return $ this ->delete ('orgs/ ' .rawurlencode ($ organization ).'/public_members/ ' .rawurlencode ($ username ));
4747 }
4848
49+ /*
50+ * Add user to organization
51+ */
52+ public function add ($ organization , $ username )
53+ {
54+ return $ this ->put ('orgs/ ' .rawurlencode ($ organization ).'/memberships/ ' .rawurlencode ($ username ));
55+ }
56+
4957 public function remove ($ organization , $ username )
5058 {
5159 return $ this ->delete ('orgs/ ' .rawurlencode ($ organization ).'/members/ ' .rawurlencode ($ username ));
Original file line number Diff line number Diff line change @@ -54,6 +54,22 @@ public function shouldCheckIfOrganizationMember()
5454 $ this ->assertEquals ($ expectedValue , $ api ->check ('KnpLabs ' , 'l3l0 ' ));
5555 }
5656
57+ /**
58+ * @test
59+ */
60+ public function shouldAddOrganizationMember ()
61+ {
62+ $ expectedValue = 'response ' ;
63+
64+ $ api = $ this ->getApiMock ();
65+ $ api ->expects ($ this ->once ())
66+ ->method ('put ' )
67+ ->with ('orgs/KnpLabs/memberships/l3l0 ' )
68+ ->will ($ this ->returnValue ($ expectedValue ));
69+
70+ $ this ->assertEquals ($ expectedValue , $ api ->add ('KnpLabs ' , 'l3l0 ' ));
71+ }
72+
5773 /**
5874 * @test
5975 */
You can’t perform that action at this time.
0 commit comments