| Conditions | 1 |
| Paths | 1 |
| Total Lines | 30 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function testSetUserEmail_() |
||
| 19 | { |
||
| 20 | $userDetails = [ |
||
| 21 | 'email' => '[email protected]', |
||
| 22 | 'name' => 'Hello', |
||
| 23 | 'password' => 'secret', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | // get the logged in user (create one if no one is logged in) |
||
| 27 | $user = $this->registerAndLoginTestingUser($userDetails); |
||
| 28 | |||
| 29 | $data = [ |
||
| 30 | 'email' => '[email protected]', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | // mock sending real emails |
||
| 34 | $confirmEmail = $this->mock(ConfirmEmail::class); |
||
| 35 | $confirmEmail->shouldReceive('send')->once()->withAnyArgs()->andReturn(true); |
||
| 36 | $confirmEmail->shouldReceive('setEmail')->once()->withAnyArgs(); |
||
| 37 | $confirmEmail->shouldReceive('setName')->once()->withAnyArgs(); |
||
| 38 | |||
| 39 | $this->endpoint = str_replace("{id}", $user->id, $this->endpoint); |
||
| 40 | |||
| 41 | // send the HTTP request |
||
| 42 | $response = $this->apiCall($this->endpoint, 'post', $data, true); |
||
| 43 | |||
| 44 | // assert response status is correct |
||
| 45 | $this->assertEquals($response->getStatusCode(), '202'); |
||
| 46 | |||
| 47 | } |
||
| 48 | |||
| 50 |