| @@ 85-106 (lines=22) @@ | ||
| 82 | } |
|
| 83 | ||
| 84 | /** @test */ |
|
| 85 | public function it_can_subscribe_someone_with_merge_fields() |
|
| 86 | { |
|
| 87 | $email = '[email protected]'; |
|
| 88 | ||
| 89 | $mergeFields = ['FNAME' => 'Freek']; |
|
| 90 | ||
| 91 | $url = 'lists/123/members'; |
|
| 92 | ||
| 93 | $this->mailChimpApi->shouldReceive('post') |
|
| 94 | ->once() |
|
| 95 | ->withArgs([ |
|
| 96 | $url, |
|
| 97 | [ |
|
| 98 | 'email_address' => $email, |
|
| 99 | 'status' => 'subscribed', |
|
| 100 | 'merge_fields' => $mergeFields, |
|
| 101 | 'email_type' => 'html', |
|
| 102 | ], |
|
| 103 | ]); |
|
| 104 | ||
| 105 | $this->newsletter->subscribe($email, $mergeFields); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** @test */ |
|
| 109 | public function it_can_subscribe_or_update_someone_with_merge_fields() |
|
| @@ 109-130 (lines=22) @@ | ||
| 106 | } |
|
| 107 | ||
| 108 | /** @test */ |
|
| 109 | public function it_can_subscribe_or_update_someone_with_merge_fields() |
|
| 110 | { |
|
| 111 | $email = '[email protected]'; |
|
| 112 | ||
| 113 | $mergeFields = ['FNAME' => 'Freek']; |
|
| 114 | ||
| 115 | $url = 'lists/123/members'; |
|
| 116 | ||
| 117 | $this->mailChimpApi->shouldReceive('put') |
|
| 118 | ->once() |
|
| 119 | ->withArgs([ |
|
| 120 | $url, |
|
| 121 | [ |
|
| 122 | 'email_address' => $email, |
|
| 123 | 'status' => 'subscribed', |
|
| 124 | 'merge_fields' => $mergeFields, |
|
| 125 | 'email_type' => 'html', |
|
| 126 | ], |
|
| 127 | ]); |
|
| 128 | ||
| 129 | $this->newsletter->subscribeOrUpdate($email, $mergeFields); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** @test */ |
|
| 133 | public function it_can_subscribe_someone_to_an_alternative_list() |
|