Skip to content

Commit 604016d

Browse files
committed
API: Add Listing Customer Package with Accessible Versions Method
1 parent 6c846fb commit 604016d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/Api/Customers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public function listPackages($customerIdOrUrlName)
7171
return $this->get(sprintf('/customers/%s/packages/', $customerIdOrUrlName));
7272
}
7373

74+
public function listCustomerPackage($customerIdOrUrlName, $packageName)
75+
{
76+
return $this->get(sprintf('/customers/%s/packages/%s/', $customerIdOrUrlName, $packageName));
77+
}
78+
7479
/**
7580
* @deprecated Use addOrEditPackages instead
7681
*/

tests/Api/CustomersTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,34 @@ public function testListPackages()
203203
$this->assertSame($expected, $api->listPackages(1));
204204
}
205205

206+
public function testListCustomerPackage()
207+
{
208+
$expected = [
209+
'name' => 'composer/composer',
210+
'origin' => 'private',
211+
'versionConstraint' => null,
212+
'expirationDate' => null,
213+
'versions' => [
214+
[
215+
'version' => '2.3.9',
216+
'versionNormalized' => '2.3.9.0',
217+
'sourceReference' => '015f524c9969255a29cdea8890cbd4fec240ee47',
218+
'distReference' => '015f524c9969255a29cdea8890cbd4fec240ee47',
219+
'releasedAt' => '2022-07-05T14:52:00+00:00',
220+
],
221+
],
222+
];
223+
224+
/** @var Customers&MockObject $api */
225+
$api = $this->getApiMock();
226+
$api->expects($this->once())
227+
->method('get')
228+
->with($this->equalTo('/customers/1/packages/composer/composer/'))
229+
->willReturn($expected);
230+
231+
$this->assertSame($expected, $api->listCustomerPackage(1, 'composer/composer'));
232+
}
233+
206234
public function testAddOrEditPackages()
207235
{
208236
$expected = [

0 commit comments

Comments
 (0)