| @@ 12-35 (lines=24) @@ | ||
| 9 | * |
|
| 10 | * @author Mahmoud Zalt <[email protected]> |
|
| 11 | */ |
|
| 12 | class CreateApplicationWithTokenTest extends TestCase |
|
| 13 | { |
|
| 14 | ||
| 15 | private $endpoint = '/apps'; |
|
| 16 | ||
| 17 | public function testCreateApplicationWithToken_() |
|
| 18 | { |
|
| 19 | $user = $this->registerAndLoginTestingDeveloper(); |
|
| 20 | ||
| 21 | $data = [ |
|
| 22 | 'name' => 'My first App' |
|
| 23 | ]; |
|
| 24 | ||
| 25 | // send the HTTP request |
|
| 26 | $response = $this->apiCall($this->endpoint, 'post', $data); |
|
| 27 | ||
| 28 | // assert response status is correct |
|
| 29 | $this->assertEquals($response->getStatusCode(), '200'); |
|
| 30 | ||
| 31 | // assert response contain the data |
|
| 32 | $this->assertResponseContainKeys(['token'], $response); |
|
| 33 | } |
|
| 34 | ||
| 35 | } |
|
| 36 | ||
| @@ 12-33 (lines=22) @@ | ||
| 9 | * |
|
| 10 | * @author Mahmoud Zalt <[email protected]> |
|
| 11 | */ |
|
| 12 | class DeleteUserTest extends TestCase |
|
| 13 | { |
|
| 14 | ||
| 15 | private $endpoint = '/users'; |
|
| 16 | ||
| 17 | public function testDeleteExistingUser_() |
|
| 18 | { |
|
| 19 | $user = $this->getLoggedInTestingAdmin(); |
|
| 20 | ||
| 21 | // send the HTTP request |
|
| 22 | $response = $this->apiCall($this->endpoint, 'delete'); |
|
| 23 | ||
| 24 | // assert response status is correct |
|
| 25 | $this->assertEquals($response->getStatusCode(), '202'); |
|
| 26 | ||
| 27 | // assert the returned message is correct |
|
| 28 | $this->assertResponseContainKeyValue([ |
|
| 29 | 'message' => 'User (' . $user->id . ') Deleted Successfully.', |
|
| 30 | ], $response); |
|
| 31 | } |
|
| 32 | ||
| 33 | } |
|
| 34 | ||