1 , 'per_page' => 10, 'status' => ICompanyServiceRepository::Status_active, ); $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token); $response = $this->action( "GET", "OAuth2ConsultantsApiController@getConsultants", $params, array(), array(), array(), $headers ); $content = $response->getContent(); $consultants = json_decode($content); $this->assertResponseStatus(200); } public function testGetConsultantsCORS() { $params = array( 'page' => 1 , 'per_page' => 10, 'status' => ICompanyServiceRepository::Status_active, ); $headers = array( "HTTP_Authorization" => " Bearer " .$this->access_token, 'HTTP_Origin' => array('www.test.com'), 'HTTP_Access-Control-Request-Method'=>'GET', ); $response = $this->action( "OPTIONS", "OAuth2ConsultantsApiController@getConsultants", $params, array(), array(), array(), $headers ); $content = $response->getContent(); $consultants = json_decode($content); $this->assertResponseStatus(403); } public function testGetConsultantNotFound() { $params = array( 'id' => 0 ); $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token); $response = $this->action( "GET", "OAuth2ConsultantsApiController@getConsultant", $params, array(), array(), array(), $headers ); $content = $response->getContent(); $res = json_decode($content); $this->assertResponseStatus(404); } public function testGetConsultantFound() { $params = array( 'id' => 18 ); $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token); $response = $this->action( "GET", "OAuth2ConsultantsApiController@getConsultant", $params, array(), array(), array(), $headers ); $content = $response->getContent(); $res = json_decode($content); $this->assertResponseStatus(200); } public function testGetOffices() { $params = array( 'id' => 19 ); $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token); $response = $this->action( "GET", "OAuth2ConsultantsApiController@getOffices", $params, array(), array(), array(), $headers ); $content = $response->getContent(); $res = json_decode($content); $this->assertResponseStatus(200); } }