@@ 577-597 (lines=21) @@ | ||
574 | } |
|
575 | ||
576 | /** @test */ |
|
577 | public function it_can_add_member_tags() |
|
578 | { |
|
579 | $email = '[email protected]'; |
|
580 | ||
581 | $subscriberHash = 'abc123'; |
|
582 | ||
583 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
584 | ->once() |
|
585 | ->withArgs([$email]) |
|
586 | ->andReturn($subscriberHash); |
|
587 | ||
588 | $this->mailChimpApi |
|
589 | ->shouldReceive('post') |
|
590 | ->once() |
|
591 | ->withArgs(["lists/123/members/{$subscriberHash}/tags", ['tags' => [['name' => 'tag-1', 'status' => 'active'], ['name' => 'tag-2', 'status' => 'active']]]]) |
|
592 | ->andReturn('the-post-response'); |
|
593 | ||
594 | $actual = $this->newsletter->addTags(['tag-1', 'tag-2'], $email); |
|
595 | ||
596 | $this->assertSame('the-post-response', $actual); |
|
597 | } |
|
598 | ||
599 | /** @test */ |
|
600 | public function it_can_remove_member_tags() |
|
@@ 600-620 (lines=21) @@ | ||
597 | } |
|
598 | ||
599 | /** @test */ |
|
600 | public function it_can_remove_member_tags() |
|
601 | { |
|
602 | $email = '[email protected]'; |
|
603 | ||
604 | $subscriberHash = 'abc123'; |
|
605 | ||
606 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
607 | ->once() |
|
608 | ->withArgs([$email]) |
|
609 | ->andReturn($subscriberHash); |
|
610 | ||
611 | $this->mailChimpApi |
|
612 | ->shouldReceive('post') |
|
613 | ->once() |
|
614 | ->withArgs(["lists/123/members/{$subscriberHash}/tags", ['tags' => [['name' => 'tag-1', 'status' => 'inactive'], ['name' => 'tag-2', 'status' => 'inactive']]]]) |
|
615 | ->andReturn('the-post-response'); |
|
616 | ||
617 | $actual = $this->newsletter->removeTags(['tag-1', 'tag-2'], $email); |
|
618 | ||
619 | $this->assertSame('the-post-response', $actual); |
|
620 | } |
|
621 | } |
|
622 |