| @@ 537-557 (lines=21) @@ | ||
| 534 | } |
|
| 535 | ||
| 536 | /** @test */ |
|
| 537 | public function it_can_add_member_tags() |
|
| 538 | { |
|
| 539 | $email = '[email protected]'; |
|
| 540 | ||
| 541 | $subscriberHash = 'abc123'; |
|
| 542 | ||
| 543 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 544 | ->once() |
|
| 545 | ->withArgs([$email]) |
|
| 546 | ->andReturn($subscriberHash); |
|
| 547 | ||
| 548 | $this->mailChimpApi |
|
| 549 | ->shouldReceive('post') |
|
| 550 | ->once() |
|
| 551 | ->withArgs(["lists/123/members/{$subscriberHash}/tags", ['tags' => ['tag-1' => 'active', 'tag-2' => 'active']]]) |
|
| 552 | ->andReturn('the-post-response'); |
|
| 553 | ||
| 554 | $actual = $this->newsletter->addTags(['tag-1', 'tag-2'], $email); |
|
| 555 | ||
| 556 | $this->assertSame('the-post-response', $actual); |
|
| 557 | } |
|
| 558 | ||
| 559 | /** @test */ |
|
| 560 | public function it_can_remove_member_tags() |
|
| @@ 560-580 (lines=21) @@ | ||
| 557 | } |
|
| 558 | ||
| 559 | /** @test */ |
|
| 560 | public function it_can_remove_member_tags() |
|
| 561 | { |
|
| 562 | $email = '[email protected]'; |
|
| 563 | ||
| 564 | $subscriberHash = 'abc123'; |
|
| 565 | ||
| 566 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 567 | ->once() |
|
| 568 | ->withArgs([$email]) |
|
| 569 | ->andReturn($subscriberHash); |
|
| 570 | ||
| 571 | $this->mailChimpApi |
|
| 572 | ->shouldReceive('post') |
|
| 573 | ->once() |
|
| 574 | ->withArgs(["lists/123/members/{$subscriberHash}/tags", ['tags' => ['tag-1' => 'inactive', 'tag-2' => 'inactive']]]) |
|
| 575 | ->andReturn('the-post-response'); |
|
| 576 | ||
| 577 | $actual = $this->newsletter->removeTags(['tag-1', 'tag-2'], $email); |
|
| 578 | ||
| 579 | $this->assertSame('the-post-response', $actual); |
|
| 580 | } |
|
| 581 | } |
|
| 582 | ||