public function createAnExpectationWithRegexReplacementFromBodyAndUrl(AcceptanceTester $I) { $expectation = PhiremockClient::on(A::postRequest()->andUrl(Is::matching('/&test=(\\d+)/'))->andBody(Is::matching('/a tomato (\\d+)/')))->then(Respond::withStatusCode(200)->andBody('the numbers are ${url.1} and ${body.1}')); $this->phiremock->createExpectation($expectation); $I->sendPOST('/potato?param1=123&test=456', 'this is a tomato 3kg it weights'); $I->seeResponseCodeIs('200'); $I->seeResponseContains('the numbers are 456 and 3'); }
public function countExecutionsWhenNoExpectationIsSet(AcceptanceTester $I) { $I->sendDELETE('/__phiremock/executions'); $I->sendGET('/potato'); $I->seeResponseCodeIs(404); $I->sendGET('/potato'); $count = $this->phiremock->countExecutions(A::getRequest()->andUrl(Is::equalTo('/potato'))); $I->assertEquals(2, $count); $count = $this->phiremock->countExecutions(A::getRequest()->andUrl(Is::matching('~potato~'))); $I->assertEquals(2, $count); }