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)
46
46
return $ this ->delete ('orgs/ ' .rawurlencode ($ organization ).'/public_members/ ' .rawurlencode ($ username ));
47
47
}
48
48
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
+
49
57
public function remove ($ organization , $ username )
50
58
{
51
59
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()
54
54
$ this ->assertEquals ($ expectedValue , $ api ->check ('KnpLabs ' , 'l3l0 ' ));
55
55
}
56
56
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
+
57
73
/**
58
74
* @test
59
75
*/
You can’t perform that action at this time.
0 commit comments