Skip to content

Commit 4330025

Browse files
d-schoDavid Schönhofen
andauthored
bugfix: Fix missing ids in NoSubscriptionsFound's serialized criteria output (#4)
Co-authored-by: David Schönhofen <d.schoenhofen.dev@gmail.com>
1 parent 989e084 commit 4330025

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/Subscription/SubscriptionIds.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @implements \IteratorAggregate<SubscriptionId>
1313
*/
14-
final readonly class SubscriptionIds implements IteratorAggregate, Countable
14+
final readonly class SubscriptionIds implements IteratorAggregate, Countable, JsonSerializable
1515
{
1616
/**
1717
* @param array<string, SubscriptionId> $subscriptionIdsById
@@ -69,4 +69,12 @@ public function toStringArray(): array
6969
{
7070
return array_values(array_map(static fn (SubscriptionId $id) => $id->value, $this->subscriptionIdsById));
7171
}
72+
73+
/**
74+
* @return list<string>
75+
*/
76+
public function jsonSerialize(): array
77+
{
78+
return $this->toStringArray();
79+
}
7280
}

tests/PHPUnit/Engine/SubscriptionEngineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function test_reset_does_not_update_subscriptions_if_none_match(): void
352352
);
353353
$this->assertEmittedEngineEvents(
354354
'ResetStarted: Start to setup',
355-
'NoSubscriptionsFound: No subscriptions found for criteria: {"ids":{},"status":["NEW","BOOTING","ACTIVE","DETACHED","ERROR"]}'
355+
'NoSubscriptionsFound: No subscriptions found for criteria: {"ids":["s3"],"status":["NEW","BOOTING","ACTIVE","DETACHED","ERROR"]}'
356356
);
357357
self::assertTrue($result->successful());
358358
self::assertFalse($this->subscriptionStore->_hasPendingChanges(), 'Subscription store has pending changes');

0 commit comments

Comments
 (0)