@@ 12-38 (lines=27) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class CreatePermissionTest extends TestCase |
|
13 | { |
|
14 | ||
15 | private $endpoint = '/permissions'; |
|
16 | ||
17 | public function testCreatePermission_() |
|
18 | { |
|
19 | $admin = $this->getLoggedInTestingAdmin(); |
|
20 | ||
21 | $data = [ |
|
22 | 'name' => 'eat-people', |
|
23 | 'display_name' => 'zombie', |
|
24 | 'description' => 'can eat people', |
|
25 | ]; |
|
26 | ||
27 | // send the HTTP request |
|
28 | $response = $this->apiCall($this->endpoint, 'post', $data, true); |
|
29 | ||
30 | // assert response status is correct |
|
31 | $this->assertEquals($response->getStatusCode(), '200'); |
|
32 | ||
33 | $responseObject = $this->getResponseObject($response); |
|
34 | ||
35 | $this->assertEquals($data['name'], $responseObject->data->name); |
|
36 | } |
|
37 | ||
38 | } |
|
39 |
@@ 12-38 (lines=27) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class CreateRoleTest extends TestCase |
|
13 | { |
|
14 | ||
15 | private $endpoint = '/roles'; |
|
16 | ||
17 | public function testCreateRole_() |
|
18 | { |
|
19 | $admin = $this->getLoggedInTestingAdmin(); |
|
20 | ||
21 | $data = [ |
|
22 | 'name' => 'Manager', |
|
23 | 'display_name' => 'manager', |
|
24 | 'description' => 'he manages things', |
|
25 | ]; |
|
26 | ||
27 | // send the HTTP request |
|
28 | $response = $this->apiCall($this->endpoint, 'post', $data, true); |
|
29 | ||
30 | // assert response status is correct |
|
31 | $this->assertEquals($response->getStatusCode(), '200'); |
|
32 | ||
33 | $responseObject = $this->getResponseObject($response); |
|
34 | ||
35 | $this->assertEquals($data['name'], $responseObject->data->name); |
|
36 | } |
|
37 | ||
38 | } |
|
39 |
@@ 12-44 (lines=33) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class CreatePaypalAccountTest extends TestCase |
|
13 | { |
|
14 | ||
15 | private $endpoint = '/paypals'; |
|
16 | ||
17 | public function testCreatePaypalAccount() |
|
18 | { |
|
19 | $userDetails = [ |
|
20 | 'name' => 'Mahmoud Zalt', |
|
21 | 'email' => '[email protected]', |
|
22 | 'password' => 'passssssssssss', |
|
23 | ]; |
|
24 | // get the logged in user (create one if no one is logged in) |
|
25 | $user = $this->registerAndLoginTestingUser($userDetails); |
|
26 | ||
27 | $data = [ |
|
28 | // TODO: To Be Continue... |
|
29 | ]; |
|
30 | ||
31 | // send the HTTP request |
|
32 | $response = $this->apiCall($this->endpoint, 'post', $data, true); |
|
33 | ||
34 | // assert response status is correct |
|
35 | $this->assertEquals($response->getStatusCode(), '202'); |
|
36 | ||
37 | // convert JSON response string to Object |
|
38 | $responseObject = $this->getResponseObject($response); |
|
39 | ||
40 | $this->assertEquals($responseObject->message, 'Paypal account created successfully.'); |
|
41 | ||
42 | } |
|
43 | ||
44 | } |
|
45 |