1 | <?php |
||
9 | abstract class RestTest extends \SapphireTest { |
||
10 | |||
11 | /** |
||
12 | * The namespace of your api. |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $namespace = 'v/1'; |
||
16 | |||
17 | /** |
||
18 | * The route to the session without the namespace. |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $sessionRoute = 'sessions'; |
||
22 | |||
23 | public function setUp() { |
||
28 | |||
29 | |||
30 | /** |
||
31 | * Perform an api request with the given options |
||
32 | * |
||
33 | * @param string $path the request path; can consist of resource name, identifier and GET params |
||
34 | * @param array $options |
||
35 | * * string `body` the data |
||
36 | * * int `code` the expected response code |
||
37 | * * string `method` the http method |
||
38 | * * ApiSession `session` the test session |
||
39 | * * string `token` the auth token |
||
40 | * * array `postVars` the post data, eg. multi form or files |
||
41 | * @return array |
||
42 | * @throws \SS_HTTPResponse_Exception |
||
43 | */ |
||
44 | protected function makeApiRequest($path, $options=[]) { |
||
70 | |||
71 | /** |
||
72 | * Creates a session for the api. |
||
73 | * |
||
74 | * @param string $email the email of the user |
||
75 | * @param string $password the password for the user |
||
76 | * @return array the current session with `token` |
||
77 | */ |
||
78 | protected function createSession($email='[email protected]', $password='password') { |
||
87 | } |
||
88 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: