/** * @Then response has/contains the following Content Type Groups: */ public function responseHasFollowingContentTypeGroups(TableNode $table) { // get groups $groups = GherkinHelper::convertTableToArrayOfData($table); // verify if the expects objects are in the list foreach ($this->getResponseObject() as $ContentTypeGroup) { $found = array_search($ContentTypeGroup->identifier, $groups); if ($found !== false) { unset($groups[$found]); } } // verify if all the expected groups were found Assertion::assertEmpty($groups, "Expected to find all groups but couldn't find: " . print_r($groups, true)); }
/** * Simple override for the following sentences: * - Given I filled form with: * - When I fill form with: */ public function iFillFormWith(TableNode $table) { foreach (GherkinHelper::convertTableToArrayOfData($table) as $field => $value) { // fill the form $el = $this->findFieldElement($field); $el->setValue($value); } }
/** * @Then I see field with value: * * Checks a form for the provided field/value pairs: * | field | value | * | Title | A title text | * | Content | Some content | * * @deprecated deprecated since version 6.3.0 */ public function formHasValue(TableNode $table) { trigger_error("onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0", E_USER_DEPRECATED); foreach (GherkinHelper::convertTableToArrayOfData($table) as $field => $value) { $elements = $this->getXpath()->findFields($field); Assertion::assertNotEmpty($elements, "Unable to find '{$field}' field"); Assertion::assertEquals($value, $elements[0]->getValue(), "Field values don't match"); } }
/** * @When I set headers: */ public function setHeaders(TableNode $table) { $headers = GherkinHelper::convertTableToArrayOfData($table); foreach ($headers as $header => $value) { $this->iAddHeaderWithValue($header, $value); } }