From a57bc77dd44ace0c53909ce75d9ad27ad2b696e4 Mon Sep 17 00:00:00 2001 From: Lee Wallis Date: Tue, 7 Oct 2025 21:10:32 +1000 Subject: [PATCH 1/2] Added in missing by_slugs parameter when retrieving stories --- src/Request/StoriesRequest.php | 5 +++++ tests/Unit/Request/StoriesRequestTest.php | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Request/StoriesRequest.php b/src/Request/StoriesRequest.php index e034c1e..b08449a 100644 --- a/src/Request/StoriesRequest.php +++ b/src/Request/StoriesRequest.php @@ -61,6 +61,7 @@ public function __construct( public ?FirstPublishedAtLt $firstPublishedAtLt = null, public ?UpdatedAtGt $updatedAtGt = null, public ?UpdatedAtLt $updatedAtLt = null, + public ?SlugCollection $bySlugs = new SlugCollection(), ) { Assert::stringNotEmpty($language); Assert::lessThanEq($this->pagination->perPage, self::MAX_PER_PAGE); @@ -168,6 +169,10 @@ public function toArray(): array $array['updated_at_lt'] = $this->updatedAtLt->toString(); } + if ($this->bySlugs->count() > 0) { + $array['by_slugs'] = $this->bySlugs->toString(); + } + return $array; } } diff --git a/tests/Unit/Request/StoriesRequestTest.php b/tests/Unit/Request/StoriesRequestTest.php index c8dda1f..3a9c0dc 100644 --- a/tests/Unit/Request/StoriesRequestTest.php +++ b/tests/Unit/Request/StoriesRequestTest.php @@ -348,4 +348,22 @@ public function toArrayWithUpdatedAtLt(): void 'updated_at_lt' => $expectedDate, ], $request->toArray()); } + + #[Test] + public function toArrayBySlugs(): void + { + $request = new StoriesRequest( + bySlugs: new SlugCollection([ + new Slug('path/*'), + new Slug('another-path/*'), + ]), + ); + + self::assertSame([ + 'language' => 'default', + 'page' => 1, + 'per_page' => 25, + 'by_slugs' => 'path/*,another-path/*', + ], $request->toArray()); + } } From 6cfa064060936c980cea099815adbff14136d4b3 Mon Sep 17 00:00:00 2001 From: Lee Wallis Date: Tue, 7 Oct 2025 21:53:32 +1000 Subject: [PATCH 2/2] Added in missing by_slugs parameter when retrieving stories --- src/Request/StoriesRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Request/StoriesRequest.php b/src/Request/StoriesRequest.php index b08449a..b9b3d47 100644 --- a/src/Request/StoriesRequest.php +++ b/src/Request/StoriesRequest.php @@ -61,7 +61,7 @@ public function __construct( public ?FirstPublishedAtLt $firstPublishedAtLt = null, public ?UpdatedAtGt $updatedAtGt = null, public ?UpdatedAtLt $updatedAtLt = null, - public ?SlugCollection $bySlugs = new SlugCollection(), + public SlugCollection $bySlugs = new SlugCollection(), ) { Assert::stringNotEmpty($language); Assert::lessThanEq($this->pagination->perPage, self::MAX_PER_PAGE);