| @@ 273-295 (lines=23) @@ | ||
| 270 | } |
|
| 271 | ||
| 272 | /** @test */ |
|
| 273 | public function it_can_unsubscribe_someone() |
|
| 274 | { |
|
| 275 | $email = '[email protected]'; |
|
| 276 | ||
| 277 | $subscriberHash = 'abc123'; |
|
| 278 | ||
| 279 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 280 | ->once() |
|
| 281 | ->withArgs([$email]) |
|
| 282 | ->andReturn($subscriberHash); |
|
| 283 | ||
| 284 | $this->mailChimpApi |
|
| 285 | ->shouldReceive('patch') |
|
| 286 | ->once() |
|
| 287 | ->withArgs([ |
|
| 288 | "lists/123/members/{$subscriberHash}", |
|
| 289 | [ |
|
| 290 | 'status' => 'unsubscribed', |
|
| 291 | ], |
|
| 292 | ]); |
|
| 293 | ||
| 294 | $this->newsletter->unsubscribe('[email protected]'); |
|
| 295 | } |
|
| 296 | ||
| 297 | /** @test */ |
|
| 298 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| @@ 298-320 (lines=23) @@ | ||
| 295 | } |
|
| 296 | ||
| 297 | /** @test */ |
|
| 298 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| 299 | { |
|
| 300 | $email = '[email protected]'; |
|
| 301 | ||
| 302 | $subscriberHash = 'abc123'; |
|
| 303 | ||
| 304 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 305 | ->once() |
|
| 306 | ->withArgs([$email]) |
|
| 307 | ->andReturn($subscriberHash); |
|
| 308 | ||
| 309 | $this->mailChimpApi |
|
| 310 | ->shouldReceive('patch') |
|
| 311 | ->once() |
|
| 312 | ->withArgs([ |
|
| 313 | "lists/456/members/{$subscriberHash}", |
|
| 314 | [ |
|
| 315 | 'status' => 'unsubscribed', |
|
| 316 | ], |
|
| 317 | ]); |
|
| 318 | ||
| 319 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
| 320 | } |
|
| 321 | ||
| 322 | /** @test */ |
|
| 323 | public function it_can_delete_someone() |
|