| @@ 143-157 (lines=15) @@ | ||
| 140 | } |
|
| 141 | ||
| 142 | /** @test */ |
|
| 143 | public function it_will_trow_an_exceptions_when_get_members() |
|
| 144 | { |
|
| 145 | $this->response->shouldReceive('success')->andReturn(false); |
|
| 146 | ||
| 147 | $this->client->shouldReceive('get')->withArgs([ |
|
| 148 | Resources::$Contact, |
|
| 149 | [ |
|
| 150 | 'ContactsList' => "123" |
|
| 151 | ] |
|
| 152 | ])->andReturn($this->response); |
|
| 153 | ||
| 154 | ||
| 155 | $this->expectExceptionObject(ApiError::responseError('Error', 'mailjet', 400)); |
|
| 156 | $this->newsletter->getMembers(); |
|
| 157 | } |
|
| 158 | ||
| 159 | /** @test */ |
|
| 160 | public function it_can_get_the_member() |
|
| @@ 175-189 (lines=15) @@ | ||
| 172 | } |
|
| 173 | ||
| 174 | /** @test */ |
|
| 175 | public function it_will_trow_an_exception_when_get_the_member() |
|
| 176 | { |
|
| 177 | $this->response->shouldReceive('success')->andReturn(false); |
|
| 178 | ||
| 179 | $this->client->shouldReceive('get')->withArgs([ |
|
| 180 | Resources::$Contact, |
|
| 181 | [ |
|
| 182 | 'id' => 'testtest.fr' |
|
| 183 | ] |
|
| 184 | ])->andReturn($this->response); |
|
| 185 | ||
| 186 | ||
| 187 | $this->expectExceptionObject(ApiError::responseError('Error', 'mailjet', 400)); |
|
| 188 | $this->newsletter->getMember('testtest.fr'); |
|
| 189 | } |
|
| 190 | ||
| 191 | /** @test */ |
|
| 192 | public function it_can_unsubscribe_someone() |
|
| @@ 330-343 (lines=14) @@ | ||
| 327 | } |
|
| 328 | ||
| 329 | /** @test */ |
|
| 330 | public function it_will_trow_an_exception_when_check_if_member_is_subscribed() |
|
| 331 | { |
|
| 332 | $this->response->shouldReceive('success')->andReturn(false); |
|
| 333 | ||
| 334 | $this->client->shouldReceive('get')->withArgs([ |
|
| 335 | Resources::$ContactGetcontactslists, |
|
| 336 | [ |
|
| 337 | 'id' => 'testtest.fr' |
|
| 338 | ] |
|
| 339 | ])->andReturn($this->response); |
|
| 340 | ||
| 341 | $this->expectExceptionObject(ApiError::responseError('Error', 'mailjet', 400)); |
|
| 342 | $this->newsletter->isSubscribed('testtest.fr'); |
|
| 343 | } |
|
| 344 | ||
| 345 | /** @test */ |
|
| 346 | public function it_can_check_if_list_has_member() |
|
| @@ 387-400 (lines=14) @@ | ||
| 384 | } |
|
| 385 | ||
| 386 | /** @test */ |
|
| 387 | public function it_will_trow_an_exception_when_check_if_list_has_member() |
|
| 388 | { |
|
| 389 | $this->response->shouldReceive('success')->andReturn(false); |
|
| 390 | ||
| 391 | $this->client->shouldReceive('get')->withArgs([ |
|
| 392 | Resources::$Contact, |
|
| 393 | [ |
|
| 394 | 'ContactsList' => '123' |
|
| 395 | ] |
|
| 396 | ])->andReturn($this->response); |
|
| 397 | ||
| 398 | $this->expectExceptionObject(ApiError::responseError('Error', 'mailjet', 400)); |
|
| 399 | $this->newsletter->hasMember('[email protected]'); |
|
| 400 | } |
|
| 401 | } |
|
| 402 | ||