@@ -146,6 +146,51 @@ public function testDeleteSubscriptionHeaders(): void
146146 );
147147 }
148148
149+ public function testDetailSubscriptionHeaders (): void
150+ {
151+ $ mock = new MockHandler ([
152+ new Response (
153+ 200 ,
154+ ['Content-Type ' => 'application/json ' ],
155+ (string ) json_encode ([
156+ 'id ' => 'subscription-123 ' ,
157+ 'event ' => 'job-failed ' ,
158+ 'filters ' => [
159+ ['field ' => 'project.id ' , 'value ' => '123 ' ],
160+ ],
161+ 'recipient ' => ['channel ' => 'email ' , 'address ' => 'a@example.com ' ],
162+ ]),
163+ ),
164+ ]);
165+ $ requestHistory = [];
166+ $ history = Middleware::history ($ requestHistory );
167+ $ stack = HandlerStack::create ($ mock );
168+ $ stack ->push ($ history );
169+ $ client = new SubscriptionClient (
170+ 'https://example.com/ ' ,
171+ 'testToken ' ,
172+ ['handler ' => $ stack , 'backoffMaxTries ' => 3 , 'userAgent ' => 'Test ' ],
173+ );
174+
175+ $ result = $ client ->detailSubscription ('subscription-123 ' );
176+
177+ /** @var Request $request */
178+ $ request = $ requestHistory [0 ]['request ' ];
179+ self ::assertSame ('GET ' , $ request ->getMethod ());
180+ self ::assertSame ('https://example.com/project-subscriptions/subscription-123 ' , (string ) $ request ->getUri ());
181+ self ::assertSame (
182+ ['User-Agent ' , 'X-StorageApi-Token ' , 'Host ' ],
183+ array_keys ($ request ->getHeaders ()),
184+ );
185+
186+ self ::assertSame ('subscription-123 ' , $ result ->getId ());
187+ self ::assertSame ('job-failed ' , $ result ->getEvent ());
188+ self ::assertSame ('project.id ' , $ result ->getFilters ()[0 ]->getField ());
189+ self ::assertSame ('123 ' , $ result ->getFilters ()[0 ]->getValue ());
190+ self ::assertSame ('email ' , $ result ->getRecipientChannel ());
191+ self ::assertSame ('a@example.com ' , $ result ->getRecipientAddress ());
192+ }
193+
149194 public function testListSubscriptionsHeaders (): void
150195 {
151196 $ responseBody = json_encode ([
@@ -217,6 +262,11 @@ public function testListAndDeleteSubscriptionLifecycle(): void
217262 ));
218263 self ::assertNotEmpty ($ created ->getId ());
219264
265+ // detail — must return the same subscription
266+ $ detail = $ client ->detailSubscription ($ created ->getId ());
267+ self ::assertSame ($ created ->getId (), $ detail ->getId ());
268+ self ::assertSame ('job-failed ' , $ detail ->getEvent ());
269+
220270 // list — must contain the new subscription
221271 $ beforeDelete = $ client ->listSubscriptions ();
222272 self ::assertContainsOnlyInstancesOf (
0 commit comments