| @@ 478-496 (lines=19) @@ | ||
| 475 | } |
|
| 476 | ||
| 477 | /** @test */ |
|
| 478 | public function it_can_delete_someone() |
|
| 479 | { |
|
| 480 | $email = '[email protected]'; |
|
| 481 | ||
| 482 | $subscriberHash = 'abc123'; |
|
| 483 | ||
| 484 | $this->mailChimpApi->shouldReceive('success')->andReturn(true); |
|
| 485 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 486 | ->once() |
|
| 487 | ->withArgs([$email]) |
|
| 488 | ->andReturn($subscriberHash); |
|
| 489 | ||
| 490 | $this->mailChimpApi |
|
| 491 | ->shouldReceive('delete') |
|
| 492 | ->once() |
|
| 493 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 494 | ||
| 495 | $this->newsletter->delete('[email protected]'); |
|
| 496 | } |
|
| 497 | ||
| 498 | /** @test */ |
|
| 499 | public function it_can_delete_someone_from_a_specific_list() |
|
| @@ 499-517 (lines=19) @@ | ||
| 496 | } |
|
| 497 | ||
| 498 | /** @test */ |
|
| 499 | public function it_can_delete_someone_from_a_specific_list() |
|
| 500 | { |
|
| 501 | $email = '[email protected]'; |
|
| 502 | ||
| 503 | $subscriberHash = 'abc123'; |
|
| 504 | ||
| 505 | $this->mailChimpApi->shouldReceive('success')->andReturn(true); |
|
| 506 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 507 | ->once() |
|
| 508 | ->withArgs([$email]) |
|
| 509 | ->andReturn($subscriberHash); |
|
| 510 | ||
| 511 | $this->mailChimpApi |
|
| 512 | ->shouldReceive('delete') |
|
| 513 | ->once() |
|
| 514 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 515 | ||
| 516 | $this->newsletter->delete('[email protected]', 'list2'); |
|
| 517 | } |
|
| 518 | ||
| 519 | /** @test */ |
|
| 520 | public function it_exposes_the_api() |
|
| @@ 540-558 (lines=19) @@ | ||
| 537 | } |
|
| 538 | ||
| 539 | /** @test */ |
|
| 540 | public function it_can_get_the_member() |
|
| 541 | { |
|
| 542 | $email = '[email protected]'; |
|
| 543 | ||
| 544 | $subscriberHash = 'abc123'; |
|
| 545 | ||
| 546 | $this->mailChimpApi->shouldReceive('success')->andReturn(true); |
|
| 547 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 548 | ->once() |
|
| 549 | ->withArgs([$email]) |
|
| 550 | ->andReturn($subscriberHash); |
|
| 551 | ||
| 552 | $this->mailChimpApi |
|
| 553 | ->shouldReceive('get') |
|
| 554 | ->once() |
|
| 555 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 556 | ||
| 557 | $this->newsletter->getMember($email); |
|
| 558 | } |
|
| 559 | ||
| 560 | /** @test */ |
|
| 561 | public function it_can_get_the_member_activity() |
|
| @@ 561-579 (lines=19) @@ | ||
| 558 | } |
|
| 559 | ||
| 560 | /** @test */ |
|
| 561 | public function it_can_get_the_member_activity() |
|
| 562 | { |
|
| 563 | $email = '[email protected]'; |
|
| 564 | ||
| 565 | $subscriberHash = 'abc123'; |
|
| 566 | ||
| 567 | $this->mailChimpApi->shouldReceive('success')->andReturn(true); |
|
| 568 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 569 | ->once() |
|
| 570 | ->withArgs([$email]) |
|
| 571 | ->andReturn($subscriberHash); |
|
| 572 | ||
| 573 | $this->mailChimpApi |
|
| 574 | ->shouldReceive('get') |
|
| 575 | ->once() |
|
| 576 | ->withArgs(["lists/123/members/{$subscriberHash}/activity"]); |
|
| 577 | ||
| 578 | $this->newsletter->getMemberActivity($email); |
|
| 579 | } |
|
| 580 | ||
| 581 | /** @test */ |
|
| 582 | public function it_can_get_the_member_from_a_specific_list() |
|
| @@ 582-600 (lines=19) @@ | ||
| 579 | } |
|
| 580 | ||
| 581 | /** @test */ |
|
| 582 | public function it_can_get_the_member_from_a_specific_list() |
|
| 583 | { |
|
| 584 | $email = '[email protected]'; |
|
| 585 | ||
| 586 | $subscriberHash = 'abc123'; |
|
| 587 | ||
| 588 | $this->mailChimpApi->shouldReceive('success')->andReturn(true); |
|
| 589 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 590 | ->once() |
|
| 591 | ->withArgs([$email]) |
|
| 592 | ->andReturn($subscriberHash); |
|
| 593 | ||
| 594 | $this->mailChimpApi |
|
| 595 | ->shouldReceive('get') |
|
| 596 | ->once() |
|
| 597 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 598 | ||
| 599 | $this->newsletter->getMember($email, 'list2'); |
|
| 600 | } |
|
| 601 | ||
| 602 | /** @test */ |
|
| 603 | public function is_can_create_a_campaign() |
|