File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,12 @@ Returns a new job.
170170$client->packages()->remove('acme-website/package');
171171```
172172
173+ ##### List all customers with access to a package
174+ ``` php
175+ $client->packages()->listCustomers('acme-website/package');
176+ ```
177+ Returns a list of customers with access to the package.
178+
173179#### Credential
174180
175181##### List an organization's credentials
Original file line number Diff line number Diff line change @@ -60,4 +60,9 @@ public function remove($packageName)
6060 {
6161 return $ this ->delete (sprintf ('/packages/%s/ ' , $ packageName ));
6262 }
63+
64+ public function listCustomers ($ packageName )
65+ {
66+ return $ this ->get (sprintf ('/packages/%s/customers/ ' , $ packageName ));
67+ }
6368}
Original file line number Diff line number Diff line change @@ -162,6 +162,33 @@ public function testRemove()
162162 $ this ->assertSame ($ expected , $ api ->remove ('acme-website/package ' ));
163163 }
164164
165+ public function testListPackages ()
166+ {
167+ $ expected = [
168+ [
169+ 'package ' => [
170+ 'name ' => 'composer/composer ' ,
171+ 'origin ' => 'private ' ,
172+ 'versionConstraint ' => null ,
173+ 'expirationDate ' => null ,
174+ ],
175+ 'customer ' => [
176+ 'id ' => 1 ,
177+ 'name ' => 'Customer ' ,
178+ ],
179+ ]
180+ ];
181+
182+ /** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
183+ $ api = $ this ->getApiMock ();
184+ $ api ->expects ($ this ->once ())
185+ ->method ('get ' )
186+ ->with ($ this ->equalTo ('/packages/composer/composer/customers/ ' ))
187+ ->will ($ this ->returnValue ($ expected ));
188+
189+ $ this ->assertSame ($ expected , $ api ->listCustomers ('composer/composer ' ));
190+ }
191+
165192 protected function getApiClass ()
166193 {
167194 return Packages::class;
You can’t perform that action at this time.
0 commit comments