| @@ 245-267 (lines=23) @@ | ||
| 242 | } |
|
| 243 | ||
| 244 | /** @test */ |
|
| 245 | public function it_can_unsubscribe_someone() |
|
| 246 | { |
|
| 247 | $email = '[email protected]'; |
|
| 248 | ||
| 249 | $subscriberHash = 'abc123'; |
|
| 250 | ||
| 251 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 252 | ->once() |
|
| 253 | ->withArgs([$email]) |
|
| 254 | ->andReturn($subscriberHash); |
|
| 255 | ||
| 256 | $this->mailChimpApi |
|
| 257 | ->shouldReceive('patch') |
|
| 258 | ->once() |
|
| 259 | ->withArgs([ |
|
| 260 | "lists/123/members/{$subscriberHash}", |
|
| 261 | [ |
|
| 262 | 'status' => 'unsubscribed', |
|
| 263 | ], |
|
| 264 | ]); |
|
| 265 | ||
| 266 | $this->newsletter->unsubscribe('[email protected]'); |
|
| 267 | } |
|
| 268 | ||
| 269 | /** @test */ |
|
| 270 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| @@ 270-292 (lines=23) @@ | ||
| 267 | } |
|
| 268 | ||
| 269 | /** @test */ |
|
| 270 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| 271 | { |
|
| 272 | $email = '[email protected]'; |
|
| 273 | ||
| 274 | $subscriberHash = 'abc123'; |
|
| 275 | ||
| 276 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 277 | ->once() |
|
| 278 | ->withArgs([$email]) |
|
| 279 | ->andReturn($subscriberHash); |
|
| 280 | ||
| 281 | $this->mailChimpApi |
|
| 282 | ->shouldReceive('patch') |
|
| 283 | ->once() |
|
| 284 | ->withArgs([ |
|
| 285 | "lists/456/members/{$subscriberHash}", |
|
| 286 | [ |
|
| 287 | 'status' => 'unsubscribed', |
|
| 288 | ], |
|
| 289 | ]); |
|
| 290 | ||
| 291 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
| 292 | } |
|
| 293 | ||
| 294 | /** @test */ |
|
| 295 | public function it_can_delete_someone() |
|