File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php namespace Gitlab \Api ;
2+
3+ class Version extends AbstractApi
4+ {
5+ public function show ()
6+ {
7+ return $ this ->get ('version ' );
8+ }
9+ }
Original file line number Diff line number Diff line change 3737 * @property-read \Gitlab\Api\Users $users
3838 * @property-read \Gitlab\Api\Keys $keys
3939 * @property-read \Gitlab\Api\Tags $tags
40+ * @property-read \Gitlab\Api\Version $version
4041 */
4142class Client
4243{
@@ -245,6 +246,14 @@ public function tags()
245246 return new Api \Tags ($ this );
246247 }
247248
249+ /**
250+ * @return Api\Version
251+ */
252+ public function version ()
253+ {
254+ return new Api \Version ($ this );
255+ }
256+
248257 /**
249258 * @param string $name
250259 *
@@ -305,6 +314,9 @@ public function api($name)
305314 case 'tags ' :
306315 return $ this ->tags ();
307316
317+ case 'version ' :
318+ return $ this ->version ();
319+
308320 default :
309321 throw new InvalidArgumentException ('Invalid endpoint: " ' .$ name .'" ' );
310322 }
Original file line number Diff line number Diff line change 1+ <?php namespace Gitlab \Tests \Api ;
2+
3+ class VersionTest extends TestCase
4+ {
5+ /**
6+ * @test
7+ */
8+ public function shouldShowVersion ()
9+ {
10+ $ expectedArray = array (
11+ "version " => "8.13.0-pre " ,
12+ "revision " => "4e963fe " ,
13+ );
14+
15+ $ api = $ this ->getApiMock ();
16+ $ api ->expects ($ this ->once ())
17+ ->method ('get ' )
18+ ->with ('version ' )
19+ ->will ($ this ->returnValue ($ expectedArray ));
20+ $ this ->assertEquals ($ expectedArray , $ api ->show ());
21+ }
22+ protected function getApiClass ()
23+ {
24+ return 'Gitlab\Api\Version ' ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments