public function testCorrectProgressRetrieval() { $queryProgress = new QueryProgress(); $createOrder_json = json_encode(array("deviceID" => "90:C1:15:BC:97:4F", "order" => 1)); $queryProgress->decodeStatusRequest($createOrder_json); $queryProgress->getStatusOrder(); $returned_response = $queryProgress->encodeMsg(); $expected_response = json_encode(array(array("item" => "Vegetarian Potjie", "status" => "done"), array("item" => "Vegetable Lasagne", "status" => "done"))); $this->assertEquals($expected_response, $returned_response); }
public function actionQueryProgress() { $model = new QueryProgress(); $request = http_get_request_body(); //$request = json_encode(array("deviceID"=>"56:78:3D:E5:8F:N1","order"=>1)); //var_dump($request); $model->decodeStatusRequest($request); $model->getStatusOrder(); $response = $model->encodeMsg(); //var_dump($response); HttpResponse::status(200); HttpResponse::setContentType('application/json'); HttpResponse::setData($response); HttpResponse::send(); }