| @@ 123-148 (lines=26) @@ | ||
| 120 | } |
|
| 121 | ||
| 122 | /** @test */ |
|
| 123 | public function it_can_subscribe_or_update_someone() |
|
| 124 | { |
|
| 125 | $this->client->shouldReceive('success')->andReturn(true); |
|
| 126 | ||
| 127 | $email = '[email protected]'; |
|
| 128 | ||
| 129 | $url = 'lists/123/members'; |
|
| 130 | ||
| 131 | $subscriberHash = 'abc123'; |
|
| 132 | ||
| 133 | $this->client->shouldReceive('subscriberHash') |
|
| 134 | ->once() |
|
| 135 | ->withArgs([$email]) |
|
| 136 | ->andReturn($subscriberHash); |
|
| 137 | ||
| 138 | $this->client->shouldReceive('put')->withArgs([ |
|
| 139 | "{$url}/{$subscriberHash}", |
|
| 140 | [ |
|
| 141 | 'email_address' => $email, |
|
| 142 | 'status' => 'subscribed', |
|
| 143 | 'email_type' => 'html', |
|
| 144 | ], |
|
| 145 | ]); |
|
| 146 | ||
| 147 | $this->newsletter->subscribeOrUpdate($email); |
|
| 148 | } |
|
| 149 | ||
| 150 | /** @test */ |
|
| 151 | public function it_can_subscribe_someone_with_merge_fields() |
|
| @@ 280-307 (lines=28) @@ | ||
| 277 | } |
|
| 278 | ||
| 279 | /** @test */ |
|
| 280 | public function it_can_subscribe_or_update_someone_to_an_alternative_list() |
|
| 281 | { |
|
| 282 | $this->client->shouldReceive('success')->andReturn(true); |
|
| 283 | ||
| 284 | $email = '[email protected]'; |
|
| 285 | ||
| 286 | $url = 'lists/456/members'; |
|
| 287 | ||
| 288 | $subscriberHash = 'abc123'; |
|
| 289 | ||
| 290 | $this->client->shouldReceive('subscriberHash') |
|
| 291 | ->once() |
|
| 292 | ->withArgs([$email]) |
|
| 293 | ->andReturn($subscriberHash); |
|
| 294 | ||
| 295 | $this->client->shouldReceive('put') |
|
| 296 | ->once() |
|
| 297 | ->withArgs([ |
|
| 298 | "{$url}/{$subscriberHash}", |
|
| 299 | [ |
|
| 300 | 'email_address' => $email, |
|
| 301 | 'status' => 'subscribed', |
|
| 302 | 'email_type' => 'html', |
|
| 303 | ], |
|
| 304 | ]); |
|
| 305 | ||
| 306 | $this->newsletter->subscribeOrUpdate($email, [], 'list2'); |
|
| 307 | } |
|
| 308 | ||
| 309 | /** @test */ |
|
| 310 | public function it_can_override_the_defaults_when_subscribing_someone() |
|