Skip to content

Commit

Permalink
Fix BatchSendingItem Endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kalianko committed Sep 19, 2024
1 parent a340dc8 commit b90afbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/Endpoint/BatchSendingItemsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Endpoint/BatchSendingItemsEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

0 comments on commit b90afbf

Please sign in to comment.