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 37
37
* @property-read \Gitlab\Api\Users $users
38
38
* @property-read \Gitlab\Api\Keys $keys
39
39
* @property-read \Gitlab\Api\Tags $tags
40
+ * @property-read \Gitlab\Api\Version $version
40
41
*/
41
42
class Client
42
43
{
@@ -245,6 +246,14 @@ public function tags()
245
246
return new Api \Tags ($ this );
246
247
}
247
248
249
+ /**
250
+ * @return Api\Version
251
+ */
252
+ public function version ()
253
+ {
254
+ return new Api \Version ($ this );
255
+ }
256
+
248
257
/**
249
258
* @param string $name
250
259
*
@@ -305,6 +314,9 @@ public function api($name)
305
314
case 'tags ' :
306
315
return $ this ->tags ();
307
316
317
+ case 'version ' :
318
+ return $ this ->version ();
319
+
308
320
default :
309
321
throw new InvalidArgumentException ('Invalid endpoint: " ' .$ name .'" ' );
310
322
}
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