File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1451,6 +1451,17 @@ public function projectAccessTokens($project_id)
1451
1451
return $ this ->get ($ this ->getProjectPath ($ project_id , 'access_tokens ' ));
1452
1452
}
1453
1453
1454
+ /**
1455
+ * @param int|string $project_id
1456
+ * @param int|string $token_id
1457
+ *
1458
+ * @return mixed
1459
+ */
1460
+ public function projectAccessToken ($ project_id , $ token_id )
1461
+ {
1462
+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'access_tokens/ ' .self ::encodePath ($ token_id )));
1463
+ }
1464
+
1454
1465
/**
1455
1466
* @param int|string $project_id
1456
1467
* @param array $parameters {
Original file line number Diff line number Diff line change @@ -2678,6 +2678,33 @@ public function shouldGetProjectAccessTokens(): void
2678
2678
$ this ->assertEquals ($ expectedArray , $ api ->projectAccessTokens (1 ));
2679
2679
}
2680
2680
2681
+ /**
2682
+ * @test
2683
+ */
2684
+ public function shouldGetProjectAccessToken (): void
2685
+ {
2686
+ $ expectedArray = [
2687
+ 'user_id ' => 141 ,
2688
+ 'scopes ' => [
2689
+ 'api ' ,
2690
+ ],
2691
+ 'name ' => 'token ' ,
2692
+ 'expires_at ' => '2021-01-31 ' ,
2693
+ 'id ' => 42 ,
2694
+ 'active ' => true ,
2695
+ 'created_at ' => '2021-01-20T22:11:48.151Z ' ,
2696
+ 'revoked ' => false ,
2697
+ ];
2698
+
2699
+ $ api = $ this ->getApiMock ();
2700
+ $ api ->expects ($ this ->once ())
2701
+ ->method ('get ' )
2702
+ ->with ('projects/1/access_tokens/42 ' )
2703
+ ->will ($ this ->returnValue ($ expectedArray ));
2704
+
2705
+ $ this ->assertEquals ($ expectedArray , $ api ->projectAccessToken (1 , 42 ));
2706
+ }
2707
+
2681
2708
/**
2682
2709
* @test
2683
2710
*/
You can’t perform that action at this time.
0 commit comments