| @@ 132-149 (lines=18) @@ | ||
| 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('delete') |
|
| 145 | ->once() |
|
| 146 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 147 | ||
| 148 | $this->newsletter->unsubscribe('[email protected]'); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** @test */ |
|
| 152 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| @@ 152-169 (lines=18) @@ | ||
| 149 | } |
|
| 150 | ||
| 151 | /** @test */ |
|
| 152 | public function it_can_unsubscribe_someone_from_a_specific_list() |
|
| 153 | { |
|
| 154 | $email = '[email protected]'; |
|
| 155 | ||
| 156 | $subscriberHash = 'abc123'; |
|
| 157 | ||
| 158 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 159 | ->once() |
|
| 160 | ->withArgs([$email]) |
|
| 161 | ->andReturn($subscriberHash); |
|
| 162 | ||
| 163 | $this->mailChimpApi |
|
| 164 | ->shouldReceive('delete') |
|
| 165 | ->once() |
|
| 166 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 167 | ||
| 168 | $this->newsletter->unsubscribe('[email protected]', 'list2'); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** @test */ |
|
| 172 | public function it_exposes_the_api() |
|
| @@ 180-197 (lines=18) @@ | ||
| 177 | } |
|
| 178 | ||
| 179 | /** @test */ |
|
| 180 | public function it_can_get_the_member() |
|
| 181 | { |
|
| 182 | $email = '[email protected]'; |
|
| 183 | ||
| 184 | $subscriberHash = 'abc123'; |
|
| 185 | ||
| 186 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 187 | ->once() |
|
| 188 | ->withArgs([$email]) |
|
| 189 | ->andReturn($subscriberHash); |
|
| 190 | ||
| 191 | $this->mailChimpApi |
|
| 192 | ->shouldReceive('get') |
|
| 193 | ->once() |
|
| 194 | ->withArgs(["lists/123/members/{$subscriberHash}"]); |
|
| 195 | ||
| 196 | $this->newsletter->getMember($email); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** @test */ |
|
| 200 | public function it_can_get_the_member_from_a_specific_list() |
|
| @@ 200-217 (lines=18) @@ | ||
| 197 | } |
|
| 198 | ||
| 199 | /** @test */ |
|
| 200 | public function it_can_get_the_member_from_a_specific_list() |
|
| 201 | { |
|
| 202 | $email = '[email protected]'; |
|
| 203 | ||
| 204 | $subscriberHash = 'abc123'; |
|
| 205 | ||
| 206 | $this->mailChimpApi->shouldReceive('subscriberHash') |
|
| 207 | ->once() |
|
| 208 | ->withArgs([$email]) |
|
| 209 | ->andReturn($subscriberHash); |
|
| 210 | ||
| 211 | $this->mailChimpApi |
|
| 212 | ->shouldReceive('get') |
|
| 213 | ->once() |
|
| 214 | ->withArgs(["lists/456/members/{$subscriberHash}"]); |
|
| 215 | ||
| 216 | $this->newsletter->getMember($email, 'list2'); |
|
| 217 | } |
|
| 218 | ||
| 219 | /** @test */ |
|
| 220 | public function is_can_create_a_campaign() |
|