enygma / frisk

An automated front-end unit testing testing tool written in PHP designed to mimic web requests and evaluate the response
http://testwithfrisk.com
14 stars 0 forks source link

Adding specific JSON searching to request #3

Closed enygma closed 13 years ago

enygma commented 13 years ago

Right now you can search JSON responses in an overall manner as a string or a set of objects. They both return a "yes, it's in there somewhere" sort of true. I want to be more specific.

I want to be able to, with a JSON response, give it a location that should exist in the object and look for it in there. For example:

$postData = array('foo'=>'bar');
$this->post('/script.php','myhost.com',$postData,'json')
    ->assertContains('find me',$obj->messages->message);

So that it looks in the returned JSON object to: 1) see if that location exists and 2) either loops through the values or matches as a string against it if it's a single value.

Shouldn't be too hard...

enygma commented 13 years ago

Added in this commit: http://github.com/enygma/frisk/commit/ea8e6e2a3b498ddb49ffdd6fabfd625667990253

Thanks jakefolio!