File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,19 @@ public function getInstallationForRepo($owner, $repo)
93
93
return $ this ->get ('/repos/ ' .rawurldecode ($ owner ).'/ ' .rawurldecode ($ repo ).'/installation ' );
94
94
}
95
95
96
+ /**
97
+ * Get an installation of the application for a user
98
+ *
99
+ * @link https://developer.github.com/v3/apps/#get-a-user-installation
100
+ *
101
+ * @param $username
102
+ * @return array
103
+ */
104
+ public function getInstallationForUser ($ username )
105
+ {
106
+ return $ this ->get ('/users/ ' .rawurldecode ($ username ).'/installation ' );
107
+ }
108
+
96
109
/**
97
110
* Delete an installation of the application
98
111
*
Original file line number Diff line number Diff line change @@ -88,6 +88,22 @@ public function shouldGetInstallationForRepo()
88
88
$ this ->assertEquals ($ result , $ api ->getInstallationForRepo ('MyOrg ' , 'MyRepo ' ));
89
89
}
90
90
91
+ /**
92
+ * @test
93
+ */
94
+ public function shouldGetInstallationForUser ()
95
+ {
96
+ $ result = ['installation1 ' ];
97
+
98
+ $ api = $ this ->getApiMock ();
99
+ $ api ->expects ($ this ->once ())
100
+ ->method ('get ' )
101
+ ->with ('/users/octocat/installation ' )
102
+ ->willReturn ($ result );
103
+
104
+ $ this ->assertEquals ($ result , $ api ->getInstallationForUser ('octocat ' ));
105
+ }
106
+
91
107
/**
92
108
* @test
93
109
*/
You can’t perform that action at this time.
0 commit comments