@@ 66-89 (lines=24) @@ | ||
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 | $subscriberHash = 'abc123'; |
|
73 | ||
74 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
75 | ->once() |
|
76 | ->withArgs([$email]) |
|
77 | ->andReturn($subscriberHash); |
|
78 | ||
79 | $this->mailChimpApi->shouldReceive('put')->withArgs([ |
|
80 | "{$url}/{$subscriberHash}", |
|
81 | [ |
|
82 | 'email_address' => $email, |
|
83 | 'status' => 'subscribed', |
|
84 | 'email_type' => 'html', |
|
85 | ], |
|
86 | ]); |
|
87 | ||
88 | $this->newsletter->subscribeOrUpdate($email); |
|
89 | } |
|
90 | ||
91 | /** @test */ |
|
92 | public function it_can_subscribe_someone_with_merge_fields() |
|
@@ 168-193 (lines=26) @@ | ||
165 | } |
|
166 | ||
167 | /** @test */ |
|
168 | public function it_can_subscribe_or_update_someone_to_an_alternative_list() |
|
169 | { |
|
170 | $email = '[email protected]'; |
|
171 | ||
172 | $url = 'lists/456/members'; |
|
173 | ||
174 | $subscriberHash = 'abc123'; |
|
175 | ||
176 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
177 | ->once() |
|
178 | ->withArgs([$email]) |
|
179 | ->andReturn($subscriberHash); |
|
180 | ||
181 | $this->mailChimpApi->shouldReceive('put') |
|
182 | ->once() |
|
183 | ->withArgs([ |
|
184 | "{$url}/{$subscriberHash}", |
|
185 | [ |
|
186 | 'email_address' => $email, |
|
187 | 'status' => 'subscribed', |
|
188 | 'email_type' => 'html', |
|
189 | ], |
|
190 | ]); |
|
191 | ||
192 | $this->newsletter->subscribeOrUpdate($email, [], 'list2'); |
|
193 | } |
|
194 | ||
195 | /** @test */ |
|
196 | public function it_can_override_the_defaults_when_subscribing_someone() |