public function creationWithOnlyValidBodyConditionTest(AcceptanceTester $I) { $I->wantTo('create an expectation that only checks body'); $request = new Request(); $request->setBody(new Condition('matches', 'potato')); $response = new Response(); $response->setStatusCode(201); $expectation = new Expectation(); $expectation->setRequest($request)->setResponse($response); $I->haveHttpHeader('Content-Type', 'application/json'); $I->sendPOST('/__phiremock/expectations', $expectation); $I->sendGET('/__phiremock/expectations'); $I->seeResponseCodeIs('200'); $I->seeResponseIsJson(); $I->seeResponseEquals('[{"scenarioName":null,"scenarioStateIs":null,"newScenarioState":null,' . '"request":{"method":null,"url":null,"body":{"matches":"potato"},"headers":null},' . '"response":{"statusCode":201,"body":null,"headers":null,"delayMillis":null},' . '"proxyTo":null,"priority":0}]'); }
public function responseExpectedWhenRequestBodyCaseInsensitiveEqualsTest(AcceptanceTester $I) { $I->wantTo('see if mocking based in request body case insensitive equality works'); $request = new Request(); $request->setBody(new Condition('isSameString', 'pOtAtO')); $response = new Response(); $response->setBody('Found'); $expectation = new Expectation(); $expectation->setRequest($request)->setResponse($response); $I->haveHttpHeader('Content-Type', 'application/json'); $I->sendPOST('/__phiremock/expectations', $expectation); $I->seeResponseCodeIs(201); $I->sendPOST('/dontcare', 'potato'); $I->seeResponseCodeIs(200); $I->seeResponseEquals('Found'); }