Codeception 1.6.7

Published on September 14, 2013

This release is minor, yet fixes lots of bugs you might have encountered. If you didn’t encounter them, well, then, lucky you. Still it’s a good idea to upgrade.

Here is the list of changes.

  • fix to 80 port issue, if you had problems connecting to server via PhpBrowser, then this must be it. Thanks to @tiger-seo.
  • fix in REST module when using application/json header and passing parameters.
  • seeJsonResponseContains of REST can now search on all nesting levels. Details below.
  • fix to Sequence module.
  • Step class code improved by guilhermeFranco
  • Using suite with defined namespace was improved by @Borales.
  • Generators fixes by @piccagliani and davert.

Rest Module Changes Example

added on 09/15/2013

seeJsonResponseContains behavior is less strict now. Now you it checks for any inclusion of provided json in Response, and works for unordered arrays as well. Here is an example.

$response = '{"ticket": {"title": "Bug should be fixed", "user": {"name": "Davert"}, "labels": null}}';
$I->seeResponseContainsJson(array('ticket' => array('title' => 'Bug should be fixed')));
$I->seeResponseContainsJson(array('name' => 'Davert'));
$I->seeResponseContainsJson(array('user' => array('name' => 'Davert')));

In previous versions, only the first assertion would pass. But now seeJsonResponseContains will scan for inclusion on all levels of response json.

There was no other way to get it tested unordered arrays. Until 1.6.7. Here is a sample response:

        "id": 1,
        "name": "Dalhousie Website",
        "url": "",
        "hashed_url": "ad920603a18be8a41207c0529200af45"
        "id": 2,
        "name": "Wikipedia - Brasil",
        "url": "",
        "hashed_url": "01203b7a9a2a27c22bc828419d4b7dc9"

And test part that was failing in previous versions:

$I->seeResponseContainsJson(['url' =>  ""]);

Example taken from #330 The case here, if you didn’t know the index of element, you couldn’t verify it with seeJsonResponseContains. If you were using indexes, tests still should work for you.

Another change is checks for null values in response. Actually, we deserialized them in empty strings "", and this was a regular workaround to replace null with "" in tests as proposed in #381. But if you did that, you should update your tests for 1.6.7, as null work as expected now.

So this is the changes that might affect your tests. If you got issues. seeJsonResponseContains has much more detailed output on fails, so it would be easier to find the cause and get it fixed.


redownload your codeception.phar for update:

wget -O codecept.phar

for composer version

$ php composer.phar update