Skip to content

A simple extension to the PHP Resty library which lets you mock out responses

Notifications You must be signed in to change notification settings

adrianhardy/MockResty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

MockResty

I've extended Resty so that it's easy to mock responses. At the moment, it's very simple - given an HTTP method and a URL, we "send back" a static string response. That's it.

$resty = new \MockResty\MockResty();

// send back a json response
$resty->on('get','/version', json_encode(array('version'=>'0.99b')));

// change the response header to 403, but send back an empty body
$resty->on('get','/auth/forbidden', 'HTTP/1.1 403 Forbidden');

At present, MockResty is very dumb - it won't auto-json the responses, for example. It will simply return what has been set.

About

A simple extension to the PHP Resty library which lets you mock out responses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages