sendingAToWithRequesttoken('POST', $url); } /** * @Then /^the list of searched contacts has "(\d+)" contacts$/ */ public function theListOfSearchedContactsHasContacts(int $count) { $this->theHTTPStatusCodeShouldBe(200); $searchedContacts = json_decode($this->response->getBody(), $asAssociativeArray = true)['contacts']; Assert::assertEquals($count, count($searchedContacts)); } /** * @Then /^searched contact "(\d+)" is named "([^"]*)"$/ * * @param int $index * @param string $expectedName */ public function searchedContactXIsNamed(int $index, string $expectedName) { $searchedContacts = json_decode($this->response->getBody(), $asAssociativeArray = true)['contacts']; $searchedContact = $searchedContacts[$index]; Assert::assertEquals($expectedName, $searchedContact['fullName']); } }