| @@ 47-63 (lines=17) @@ | ||
| 44 | } |
|
| 45 | ||
| 46 | /** @test */ |
|
| 47 | public function it_can_subscribe_someone() |
|
| 48 | { |
|
| 49 | $email = '[email protected]'; |
|
| 50 | ||
| 51 | $url = 'lists/123/members'; |
|
| 52 | ||
| 53 | $this->mailChimpApi->shouldReceive('post')->withArgs([ |
|
| 54 | $url, |
|
| 55 | [ |
|
| 56 | 'email_address' => $email, |
|
| 57 | 'status' => 'subscribed', |
|
| 58 | 'email_type' => 'html', |
|
| 59 | ], |
|
| 60 | ]); |
|
| 61 | ||
| 62 | $this->newsletter->subscribe($email); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function it_can_subscribe_or_update_someone() |
|
| @@ 66-82 (lines=17) @@ | ||
| 63 | } |
|
| 64 | ||
| 65 | /** @test */ |
|
| 66 | public function it_can_subscribe_or_update_someone() |
|
| 67 | { |
|
| 68 | $email = '[email protected]'; |
|
| 69 | ||
| 70 | $url = 'lists/123/members'; |
|
| 71 | ||
| 72 | $this->mailChimpApi->shouldReceive('put')->withArgs([ |
|
| 73 | $url, |
|
| 74 | [ |
|
| 75 | 'email_address' => $email, |
|
| 76 | 'status' => 'subscribed', |
|
| 77 | 'email_type' => 'html', |
|
| 78 | ], |
|
| 79 | ]); |
|
| 80 | ||
| 81 | $this->newsletter->subscribeOrUpdate($email); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** @test */ |
|
| 85 | public function it_can_subscribe_someone_with_merge_fields() |
|
| @@ 133-151 (lines=19) @@ | ||
| 130 | } |
|
| 131 | ||
| 132 | /** @test */ |
|
| 133 | public function it_can_subscribe_someone_to_an_alternative_list() |
|
| 134 | { |
|
| 135 | $email = '[email protected]'; |
|
| 136 | ||
| 137 | $url = 'lists/456/members'; |
|
| 138 | ||
| 139 | $this->mailChimpApi->shouldReceive('post') |
|
| 140 | ->once() |
|
| 141 | ->withArgs([ |
|
| 142 | $url, |
|
| 143 | [ |
|
| 144 | 'email_address' => $email, |
|
| 145 | 'status' => 'subscribed', |
|
| 146 | 'email_type' => 'html', |
|
| 147 | ], |
|
| 148 | ]); |
|
| 149 | ||
| 150 | $this->newsletter->subscribe($email, [], 'list2'); |
|
| 151 | } |
|
| 152 | ||
| 153 | /** @test */ |
|
| 154 | public function it_can_subscribe_or_update_someone_to_an_alternative_list() |
|