The answers are in JSON, and I'm using a custom MVC environment, and I'm not sure how the request and response process is done. Service methods are created using the following syntax.
public function getSessionsMethod() {
A JavaScript request will look like this: /svc/api/getSessions . My initial thought was to just use the threading approach, are there any better methods for this form of testing?
public function testCanGetSessionsForAGivenId() { $params = http_build_query( array( 'id' => 3, ) ); $options = array( 'http' => array( 'method' => 'GET', 'content' => $params, ) ); $context = stream_context_create($options); $response = file_get_contents( 'http://vbates/svc/api/getSessions', false, $context ); $json = json_decode($response); $this->assertEquals(3, $json->response); }
source share