Пример #1
0
    public function testOwnController()
    {
        $response = $this->restService->simulateCall('/login', 'post');
        $this->assertEquals('{
    "status": 400,
    "error": "MissingRequiredArgumentException",
    "message": "Argument \'username\' is missing."
}', $response);
        $response = $this->restService->simulateCall('/login?username=bla', 'post');
        $this->assertEquals('{
    "status": 400,
    "error": "MissingRequiredArgumentException",
    "message": "Argument \'password\' is missing."
}', $response);
        $response = $this->restService->simulateCall('/login?username=peter&password=pwd', 'post');
        $this->assertEquals('{
    "status": 200,
    "data": true
}', $response);
        $response = $this->restService->simulateCall('/login?username=peter&password=pwd', 'get');
        $this->assertEquals('{
    "status": 400,
    "error": "RouteNotFoundException",
    "message": "There is no route for \'login\'."
}', $response);
    }