| @@ 217-239 (lines=23) @@ | ||
| 214 | } |
|
| 215 | ||
| 216 | /** @test */ |
|
| 217 | public function it_can_unsubscribe_someone() |
|
| 218 | { |
|
| 219 | $email = '[email protected]'; |
|
| 220 | ||
| 221 | $subscriberHash = 'abc123'; |
|
| 222 | ||
| 223 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 224 | ->once() |
|
| 225 | ->withArgs([$email]) |
|
| 226 | ->andReturn($subscriberHash); |
|
| 227 | ||
| 228 | $this->mailChimpApi |
|
| 229 | ->shouldReceive('patch') |
|
| 230 | ->once() |
|
| 231 | ->withArgs([ |
|
| 232 | "lists/123/members/{$subscriberHash}", |
|
| 233 | [ |
|
| 234 | 'status' => 'unsubscribed', |
|
| 235 | ], |
|
| 236 | ]); |
|
| 237 | ||
| 238 | $this->newsletter->unsubscribe('[email protected]'); |
|
| 239 | } |
|
| 240 | ||
| 241 | /** @test */ |
|
| 242 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| @@ 242-264 (lines=23) @@ | ||
| 239 | } |
|
| 240 | ||
| 241 | /** @test */ |
|
| 242 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| 243 | { |
|
| 244 | $email = '[email protected]'; |
|
| 245 | ||
| 246 | $subscriberHash = 'abc123'; |
|
| 247 | ||
| 248 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 249 | ->once() |
|
| 250 | ->withArgs([$email]) |
|
| 251 | ->andReturn($subscriberHash); |
|
| 252 | ||
| 253 | $this->mailChimpApi |
|
| 254 | ->shouldReceive('patch') |
|
| 255 | ->once() |
|
| 256 | ->withArgs([ |
|
| 257 | "lists/456/members/{$subscriberHash}", |
|
| 258 | [ |
|
| 259 | 'status' => 'unsubscribed', |
|
| 260 | ], |
|
| 261 | ]); |
|
| 262 | ||
| 263 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
| 264 | } |
|
| 265 | ||
| 266 | /** @test */ |
|
| 267 | public function it_can_delete_someone() |
|