@@ -39,4 +39,50 @@ public function testListReturnsBounceCollection(): void
3939 $ this ->assertSame (123 , $ result ->items [0 ]->messageId );
4040 $ this ->assertSame ('user@example.com ' , $ result ->items [0 ]->subscriberEmail );
4141 }
42+
43+ public function testListByCampaignReturnsRawArray (): void
44+ {
45+ $ mockClient = $ this ->createMock (Client::class);
46+ $ mockClient ->expects ($ this ->once ())
47+ ->method ('get ' )
48+ ->with ('bounces/by/campaign ' )
49+ ->willReturn ([
50+ [
51+ 'message_id ' => 1 ,
52+ 'subject ' => 'System ' ,
53+ 'total_bounces ' => 3 ,
54+ ],
55+ ]);
56+
57+ $ bouncesClient = new BouncesClient ($ mockClient );
58+ $ result = $ bouncesClient ->listByCampaign ();
59+
60+ $ this ->assertIsArray ($ result );
61+ $ this ->assertSame (1 , $ result [0 ]['message_id ' ]);
62+ $ this ->assertSame (3 , $ result [0 ]['total_bounces ' ]);
63+ }
64+
65+ public function testListBySubscriberReturnsRawArray (): void
66+ {
67+ $ mockClient = $ this ->createMock (Client::class);
68+ $ mockClient ->expects ($ this ->once ())
69+ ->method ('get ' )
70+ ->with ('bounces/by/subscriber ' )
71+ ->willReturn ([
72+ [
73+ 'subscriber_id ' => 1 ,
74+ 'email ' => 'example@email.com ' ,
75+ 'confirmed ' => true ,
76+ 'blacklisted ' => false ,
77+ 'total_bounces ' => 2 ,
78+ ],
79+ ]);
80+
81+ $ bouncesClient = new BouncesClient ($ mockClient );
82+ $ result = $ bouncesClient ->listBySubscriber ();
83+
84+ $ this ->assertIsArray ($ result );
85+ $ this ->assertSame (1 , $ result [0 ]['subscriber_id ' ]);
86+ $ this ->assertSame (2 , $ result [0 ]['total_bounces ' ]);
87+ }
4288}
0 commit comments