igorsantos07 · GitHub

Codeception version 1.6.1.1, from composer dev-master.

I'm trying to use the seeResponseContainsJson method from the REST Module, but it's not working properly (hope it's not me doing bad stuff):

Sample Cept file:

$I = new ApiGuy($scenario);
$I->wantTo('get all available pages');
$I->sendGET('page'); //fine
$I->seeResponseCodeIs(200); //fine
$I->seeResponseIsJson(); //fine
$I->seeResponseContainsJson(json_decode('{
        "id": 2,
        "name": "Wikipedia - Brasil",
        "url": "http://pt.wikipedia.org/wiki/Brasil",
        "hashed_url": "01203b7a9a2a27c22bc828419d4b7dc9"
}', true));
/* this JSON was pasted directly from the response error log
 * below, just for testing purposes */

I get an error saying my guy was unable to see the given json in the response. Here's what placed in the log folder, related to the test above:

[
    {
        "id": 1,
        "name": "Dalhousie Website",
        "url": "http://www.dal.ca",
        "hashed_url": "ad920603a18be8a41207c0529200af45"
    },
    {
        "id": 2,
        "name": "Wikipedia - Brasil",
        "url": "http://pt.wikipedia.org/wiki/Brasil",
        "hashed_url": "01203b7a9a2a27c22bc828419d4b7dc9"
    }
]

The original test (without the pasted JSON) used as value for the method ['url' => 'http://pt.wikipedia.org/wiki/Brasil'] (running PHP 5.4).

Read the original on github.com ↗