| @@ 346-363 (lines=18) @@ | ||
| 343 | } |
|
| 344 | ||
| 345 | /** @test */ |
|
| 346 | public function it_can_delete_someone() |
|
| 347 | { |
|
| 348 | $email = '[email protected]'; |
|
| 349 | ||
| 350 | $subscriberHash = 'abc123'; |
|
| 351 | ||
| 352 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 353 | ->once() |
|
| 354 | ->withArgs([$email]) |
|
| 355 | ->andReturn($subscriberHash); |
|
| 356 | ||
| 357 | $this->mailChimpApi |
|
| 358 | ->shouldReceive('delete') |
|
| 359 | ->once() |
|
| 360 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 361 | ||
| 362 | $this->newsletter->delete('[email protected]'); |
|
| 363 | } |
|
| 364 | ||
| 365 | /** @test */ |
|
| 366 | public function it_can_delete_someone_from_a_specific_list() |
|
| @@ 366-383 (lines=18) @@ | ||
| 363 | } |
|
| 364 | ||
| 365 | /** @test */ |
|
| 366 | public function it_can_delete_someone_from_a_specific_list() |
|
| 367 | { |
|
| 368 | $email = '[email protected]'; |
|
| 369 | ||
| 370 | $subscriberHash = 'abc123'; |
|
| 371 | ||
| 372 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 373 | ->once() |
|
| 374 | ->withArgs([$email]) |
|
| 375 | ->andReturn($subscriberHash); |
|
| 376 | ||
| 377 | $this->mailChimpApi |
|
| 378 | ->shouldReceive('delete') |
|
| 379 | ->once() |
|
| 380 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 381 | ||
| 382 | $this->newsletter->delete('[email protected]', 'list2'); |
|
| 383 | } |
|
| 384 | ||
| 385 | /** @test */ |
|
| 386 | public function it_can_delete_someone_permanently() |
|
| @@ 386-403 (lines=18) @@ | ||
| 383 | } |
|
| 384 | ||
| 385 | /** @test */ |
|
| 386 | public function it_can_delete_someone_permanently() |
|
| 387 | { |
|
| 388 | $email = '[email protected]'; |
|
| 389 | ||
| 390 | $subscriberHash = 'abc123'; |
|
| 391 | ||
| 392 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 393 | ->once() |
|
| 394 | ->withArgs([$email]) |
|
| 395 | ->andReturn($subscriberHash); |
|
| 396 | ||
| 397 | $this->mailChimpApi |
|
| 398 | ->shouldReceive('post') |
|
| 399 | ->once() |
|
| 400 | ->withArgs(["lists/123/members/{$subscriberHash}/actions/delete-permanent"]); |
|
| 401 | ||
| 402 | $this->newsletter->deletePermanently('[email protected]'); |
|
| 403 | } |
|
| 404 | ||
| 405 | /** @test */ |
|
| 406 | public function it_can_delete_someone_permanently_from_a_specific_list() |
|
| @@ 406-423 (lines=18) @@ | ||
| 403 | } |
|
| 404 | ||
| 405 | /** @test */ |
|
| 406 | public function it_can_delete_someone_permanently_from_a_specific_list() |
|
| 407 | { |
|
| 408 | $email = '[email protected]'; |
|
| 409 | ||
| 410 | $subscriberHash = 'abc123'; |
|
| 411 | ||
| 412 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 413 | ->once() |
|
| 414 | ->withArgs([$email]) |
|
| 415 | ->andReturn($subscriberHash); |
|
| 416 | ||
| 417 | $this->mailChimpApi |
|
| 418 | ->shouldReceive('post') |
|
| 419 | ->once() |
|
| 420 | ->withArgs(["lists/456/members/{$subscriberHash}/actions/delete-permanent"]); |
|
| 421 | ||
| 422 | $this->newsletter->deletePermanently('[email protected]', 'list2'); |
|
| 423 | } |
|
| 424 | ||
| 425 | /** @test */ |
|
| 426 | public function it_exposes_the_api() |
|
| @@ 445-462 (lines=18) @@ | ||
| 442 | } |
|
| 443 | ||
| 444 | /** @test */ |
|
| 445 | public function it_can_get_the_member() |
|
| 446 | { |
|
| 447 | $email = '[email protected]'; |
|
| 448 | ||
| 449 | $subscriberHash = 'abc123'; |
|
| 450 | ||
| 451 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 452 | ->once() |
|
| 453 | ->withArgs([$email]) |
|
| 454 | ->andReturn($subscriberHash); |
|
| 455 | ||
| 456 | $this->mailChimpApi |
|
| 457 | ->shouldReceive('get') |
|
| 458 | ->once() |
|
| 459 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 460 | ||
| 461 | $this->newsletter->getMember($email); |
|
| 462 | } |
|
| 463 | ||
| 464 | /** @test */ |
|
| 465 | public function it_can_get_the_member_activity() |
|
| @@ 465-482 (lines=18) @@ | ||
| 462 | } |
|
| 463 | ||
| 464 | /** @test */ |
|
| 465 | public function it_can_get_the_member_activity() |
|
| 466 | { |
|
| 467 | $email = '[email protected]'; |
|
| 468 | ||
| 469 | $subscriberHash = 'abc123'; |
|
| 470 | ||
| 471 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 472 | ->once() |
|
| 473 | ->withArgs([$email]) |
|
| 474 | ->andReturn($subscriberHash); |
|
| 475 | ||
| 476 | $this->mailChimpApi |
|
| 477 | ->shouldReceive('get') |
|
| 478 | ->once() |
|
| 479 | ->withArgs(["lists/123/members/{$subscriberHash}/activity"]); |
|
| 480 | ||
| 481 | $this->newsletter->getMemberActivity($email); |
|
| 482 | } |
|
| 483 | ||
| 484 | /** @test */ |
|
| 485 | public function it_can_get_the_member_from_a_specific_list() |
|
| @@ 485-502 (lines=18) @@ | ||
| 482 | } |
|
| 483 | ||
| 484 | /** @test */ |
|
| 485 | public function it_can_get_the_member_from_a_specific_list() |
|
| 486 | { |
|
| 487 | $email = '[email protected]'; |
|
| 488 | ||
| 489 | $subscriberHash = 'abc123'; |
|
| 490 | ||
| 491 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 492 | ->once() |
|
| 493 | ->withArgs([$email]) |
|
| 494 | ->andReturn($subscriberHash); |
|
| 495 | ||
| 496 | $this->mailChimpApi |
|
| 497 | ->shouldReceive('get') |
|
| 498 | ->once() |
|
| 499 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 500 | ||
| 501 | $this->newsletter->getMember($email, 'list2'); |
|
| 502 | } |
|
| 503 | ||
| 504 | /** @test */ |
|
| 505 | public function it_can_create_a_campaign() |
|