REST methods can be used to inspect responses of other modules #2507

Merged
merged 10 commits into from Nov 5, 2015

Conversation

Projects
None yet
3 participants
@Naktibalda
Member

Naktibalda commented Oct 31, 2015

Introduced _getResponseContent helper method to InnerBrowser.
Used it in all REST response methods to enable tests like this.

$I->amOnPage('/rest/user/');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();

Related ticket #2496

@Lance0312

This comment has been minimized.

Show comment
Hide comment

👍

src/Codeception/Lib/InnerBrowser.php
+
+ /**
+ * Returns content of the last response
+ *

This comment has been minimized.

@DavertMik

DavertMik Nov 3, 2015

Member

It would be good to have a usage example here:

basic one:

$content = $this->getModule('{{MODULE_NAME}}')->_getResponseContent();

or something like real example:

function seeMobileReady() {
    $content = $this->getModule('{{MODULE_NAME}}')->_getResponseContent();
    $this->assertRegex('~<meta (/*?)name="viewport"~', $content);
}

and yeah, you can include your example with REST module as well!

@DavertMik

DavertMik Nov 3, 2015

Member

It would be good to have a usage example here:

basic one:

$content = $this->getModule('{{MODULE_NAME}}')->_getResponseContent();

or something like real example:

function seeMobileReady() {
    $content = $this->getModule('{{MODULE_NAME}}')->_getResponseContent();
    $this->assertRegex('~<meta (/*?)name="viewport"~', $content);
}

and yeah, you can include your example with REST module as well!

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Nov 3, 2015

Member

Great! Just improve the example and as for me it is ready for merging

Member

DavertMik commented Nov 3, 2015

Great! Just improve the example and as for me it is ready for merging

Naktibalda added a commit that referenced this pull request Nov 5, 2015

Merge pull request #2507 from Naktibalda/rest-refactoring
REST methods can be used to inspect responses of other modules

@Naktibalda Naktibalda merged commit e43222b into Codeception:2.1 Nov 5, 2015

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor AppVeyor build succeeded
Details

@Naktibalda Naktibalda deleted the Naktibalda:rest-refactoring branch Dec 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment