File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ public function all()
20
20
21
21
public function create (array $ tokenData )
22
22
{
23
+ if (isset ($ tokenData ['teamId ' ], $ tokenData ['accessToAllPackages ' ])) {
24
+ throw new InvalidArgumentException ('Only set either "accessToAllPackages" or "teamId" ' );
25
+ }
26
+
23
27
return $ this ->post ('/tokens/ ' , $ tokenData );
24
28
}
25
29
Original file line number Diff line number Diff line change @@ -67,6 +67,22 @@ public function testCreate()
67
67
]));
68
68
}
69
69
70
+ public function testCreateTeamIdAndAllAccess ()
71
+ {
72
+ $ this ->expectException (\InvalidArgumentException::class);
73
+ /** @var Tokens&MockObject $api */
74
+ $ api = $ this ->getApiMock ();
75
+ $ api ->expects ($ this ->never ())
76
+ ->method ('post ' );
77
+
78
+ $ api ->create ([
79
+ 'description ' => 'Team Token ' ,
80
+ 'access ' => 'read ' ,
81
+ 'teamId ' => 1 ,
82
+ 'accessToAllPackages ' => true ,
83
+ ]);
84
+ }
85
+
70
86
public function testRemove ()
71
87
{
72
88
$ expected = [];
You can’t perform that action at this time.
0 commit comments