lumen- Framework 5.8, for example
1, the bin directory into which the vendor environment variables;
2, routing settings
$router->get('syn', ['uses' => 'syn\syn@dictionaryOptions',]);
3, do experiments in ExampleTest documents in the testExample method under test directory
Goal 1: Interface test the return value
// value test return values and their own pre-set for equality // $ a = $ this-> get ( 'syn'); call routing provided // print_r (($ a-> response)); die; Return Value print routing // print_r (json_decode ($ a-> response-> getContent (), true)); die; // returned data view; // the return value is equal //$this->assertEquals( // [], $this->response->getContent() //);
Objective 2: To test the return value of the interface, there are no data you want
// $ this-> json ( 'get ', 'syn') -> seeJson ([ 'msg' => 'success',]); // partial matches
, such as: a return json array [ 'a' => 1, 'b' => 2 ]; if [ 'a' => 1] or [ 'b' in which an array inside seeJson => one 2] verifies successful
// $ this-> json ( 'get', 'syn') -> seeJsonEquals ([ 'msg' => 'success',]); // All matching
3 objectives: to verify the status of the interface via the test interface to return
//$response = $this->call('GET', 'syn'); // print_r ($ response-> getStatusCode ()); die; // get the status it; //$this->assertEquals(200, $response->status());