learning Lumen v5.5 php framework and have hit a roadblock creating my first php unit test. The app works using Postman if I set the URL and select POST method and in the body choose "raw" and set the type to "application/json". So we already know the post works, just looking to crate a test.
Here is the closest thing to what i think a working unit test should be:
public function testPostJson() {
$the_json = '{"client_guid": "C00A0EA5-3F64-01EA-C4B6-159EA145AB3B"}';
$the_headers = [ 'CONTENT_TYPE' => 'application/json' ];
$this->call(
'POST',
'/getClientNotes',
[],
[],
[],
$the_headers,
$the_json
);
$this->assertResponseOk();
$this->assertEquals(true, $this->response->status);
}
But of course it returns errors like:
- 1) NotesTest::testPostJson Expected status code 200, got 404.*
- 2) ErrorException: Undefined property: Illuminate\Http\Response::$status
Not much in the way of documentation even at the lumen docs site: http://ift.tt/2xtF7pl
Aucun commentaire:
Enregistrer un commentaire