@@ 296-318 (lines=23) @@ | ||
293 | } |
|
294 | ||
295 | /** @test */ |
|
296 | public function it_can_unsubscribe_someone() |
|
297 | { |
|
298 | $email = '[email protected]'; |
|
299 | ||
300 | $subscriberHash = 'abc123'; |
|
301 | ||
302 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
303 | ->once() |
|
304 | ->withArgs([$email]) |
|
305 | ->andReturn($subscriberHash); |
|
306 | ||
307 | $this->mailChimpApi |
|
308 | ->shouldReceive('patch') |
|
309 | ->once() |
|
310 | ->withArgs([ |
|
311 | "lists/123/members/{$subscriberHash}", |
|
312 | [ |
|
313 | 'status' => 'unsubscribed', |
|
314 | ], |
|
315 | ]); |
|
316 | ||
317 | $this->newsletter->unsubscribe('[email protected]'); |
|
318 | } |
|
319 | ||
320 | /** @test */ |
|
321 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
@@ 321-343 (lines=23) @@ | ||
318 | } |
|
319 | ||
320 | /** @test */ |
|
321 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
322 | { |
|
323 | $email = '[email protected]'; |
|
324 | ||
325 | $subscriberHash = 'abc123'; |
|
326 | ||
327 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
328 | ->once() |
|
329 | ->withArgs([$email]) |
|
330 | ->andReturn($subscriberHash); |
|
331 | ||
332 | $this->mailChimpApi |
|
333 | ->shouldReceive('patch') |
|
334 | ->once() |
|
335 | ->withArgs([ |
|
336 | "lists/456/members/{$subscriberHash}", |
|
337 | [ |
|
338 | 'status' => 'unsubscribed', |
|
339 | ], |
|
340 | ]); |
|
341 | ||
342 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
343 | } |
|
344 | ||
345 | /** @test */ |
|
346 | public function it_can_delete_someone() |