diff --git a/src/DigiSignClient.php b/src/DigiSignClient.php index a8fa00f..80dad6b 100644 --- a/src/DigiSignClient.php +++ b/src/DigiSignClient.php @@ -138,7 +138,7 @@ private function createUri(string $uri, array $options): UriInterface { // replace uri parameters with its values preg_match_all('/{(\w+)}/', $uri, $matches); - $searches = $matches[1] ?? []; + $searches = $matches[1]; $replaces = []; foreach ($searches as $search) { diff --git a/src/Endpoint/BatchSendingItemsEndpoint.php b/src/Endpoint/BatchSendingItemsEndpoint.php index c8567e8..af296ec 100644 --- a/src/Endpoint/BatchSendingItemsEndpoint.php +++ b/src/Endpoint/BatchSendingItemsEndpoint.php @@ -21,7 +21,12 @@ final class BatchSendingItemsEndpoint extends ResourceEndpoint public function __construct(BatchSendingsEndpoint $parent, BatchSending|string $batchSending) { - parent::__construct($parent, '/{id}/items', BatchSendingItem::class, ['id' => $batchSending]); + parent::__construct( + $parent, + '/{batchSending}/items', + BatchSendingItem::class, + ['batchSending' => $batchSending], + ); } /** diff --git a/tests/Endpoint/BatchSendingItemsEndpointTest.php b/tests/Endpoint/BatchSendingItemsEndpointTest.php index 5e29671..af4ac58 100644 --- a/tests/Endpoint/BatchSendingItemsEndpointTest.php +++ b/tests/Endpoint/BatchSendingItemsEndpointTest.php @@ -12,16 +12,16 @@ class BatchSendingItemsEndpointTest extends EndpointTestCase public function testImport(): void { self::endpoint()->import(['file' => 'bar']); - self::assertLastRequest('POST', "/api/batch-sendings/foo/items/import", ['file' => 'bar']); + self::assertLastRequest('POST', "/api/batch-sendings/bar/items/import", ['file' => 'bar']); } public function testCRUD(): void { - self::assertCrudRequests(self::endpoint(), '/api/batch-sendings/foo/items'); + self::assertCrudRequests(self::endpoint(), '/api/batch-sendings/bar/items'); } protected static function endpoint(): BatchSendingItemsEndpoint { - return self::dgs()->batchSendings()->items('foo'); + return self::dgs()->batchSendings()->items('bar'); } }