I'm currently doing integration testing for my small personal project on Slim - testing with PHPunit. I set up my own test class extending the ApiTestCase class.
I only tried it with simple code and PHPStorm is not indicating any errors. I'm on PHP 7.
class SQLTest extends ApiTestCase
{
public function test_if_successful(){
$this->request('POST', '/v1/users/login', ['email' => 'm@yahoo.com', 'password' => '123']);
$this->assertThatResponseHasStatus(200);
}
}
When run on PHPunit, it gave me an error saying the function name must be a string on the line where I call the request() function.
Here is the request() function in the ApiTestCase class.
protected function request($method, $url, array $requestParameters = [])
{
$request = $this->prepareRequest($method, $url, $requestParameters);
$response = new Response();
$app = $this->app;
$this->response = $app($request, $response);
}
The error pointed is at the last line:
$this->response = $app($request, $response);