| @@ 132-154 (lines=23) @@ | ||
| 129 | } |
|
| 130 | ||
| 131 | /** @test */ |
|
| 132 | public function it_can_unsubscribe_someone() |
|
| 133 | { |
|
| 134 | $email = '[email protected]'; |
|
| 135 | ||
| 136 | $subscriberHash = 'abc123'; |
|
| 137 | ||
| 138 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 139 | ->once() |
|
| 140 | ->withArgs([$email]) |
|
| 141 | ->andReturn($subscriberHash); |
|
| 142 | ||
| 143 | $this->mailChimpApi |
|
| 144 | ->shouldReceive('patch') |
|
| 145 | ->once() |
|
| 146 | ->withArgs([ |
|
| 147 | "lists/123/members/{$subscriberHash}", |
|
| 148 | [ |
|
| 149 | 'status' => 'unsubscribed', |
|
| 150 | ], |
|
| 151 | ]); |
|
| 152 | ||
| 153 | $this->newsletter->unsubscribe('[email protected]'); |
|
| 154 | } |
|
| 155 | ||
| 156 | /** @test */ |
|
| 157 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| @@ 157-179 (lines=23) @@ | ||
| 154 | } |
|
| 155 | ||
| 156 | /** @test */ |
|
| 157 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| 158 | { |
|
| 159 | $email = '[email protected]'; |
|
| 160 | ||
| 161 | $subscriberHash = 'abc123'; |
|
| 162 | ||
| 163 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 164 | ->once() |
|
| 165 | ->withArgs([$email]) |
|
| 166 | ->andReturn($subscriberHash); |
|
| 167 | ||
| 168 | $this->mailChimpApi |
|
| 169 | ->shouldReceive('patch') |
|
| 170 | ->once() |
|
| 171 | ->withArgs([ |
|
| 172 | "lists/456/members/{$subscriberHash}", |
|
| 173 | [ |
|
| 174 | 'status' => 'unsubscribed', |
|
| 175 | ], |
|
| 176 | ]); |
|
| 177 | ||
| 178 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** @test */ |
|
| 182 | public function it_can_delete_someone() |
|