Merge pull request #3568 from tractorcow/pulls/3.1/fix-behat

BUG Fix static call to protected instance method
This commit is contained in:
Sean Harvey 2014-10-21 11:23:23 +13:00
commit 93b84358c8

View File

@ -44,6 +44,17 @@ class CmsFormsContext extends BehatContext {
return $this->getMainContext()->getSession($name);
}
/**
* Returns fixed step argument (with \\" replaced back to ").
* Copied from {@see MinkContext}
*
* @param string $argument
* @return string
*/
protected function fixStepArgument($argument) {
return str_replace('\\"', '"', $argument);
}
/**
* @Then /^I should( not? |\s*)see an edit page form$/
*/
@ -63,8 +74,8 @@ class CmsFormsContext extends BehatContext {
* @When /^I fill in "(?P<value>(?:[^"]|\\")*)" for the "(?P<field>(?:[^"]|\\")*)" HTML field$/
*/
public function stepIFillInTheHtmlFieldWith($field, $value) {
$field = MinkContext::fixStepArgument($field);
$value = MinkContext::fixStepArgument($value);
$field = $this->fixStepArgument($field);
$value = $this->fixStepArgument($value);
$page = $this->getSession()->getPage();
$inputField = $page->findField($field);
@ -81,8 +92,8 @@ class CmsFormsContext extends BehatContext {
* @When /^I append "(?P<value>(?:[^"]|\\")*)" to the "(?P<field>(?:[^"]|\\")*)" HTML field$/
*/
public function stepIAppendTotheHtmlField($field, $value) {
$field = MinkContext::fixStepArgument($field);
$value = MinkContext::fixStepArgument($value);
$field = $this->fixStepArgument($field);
$value = $this->fixStepArgument($value);
$page = $this->getSession()->getPage();
$inputField = $page->findField($field);
@ -99,7 +110,7 @@ class CmsFormsContext extends BehatContext {
* @Then /^the "(?P<locator>(?:[^"]|\\")*)" HTML field should(?P<negative> not? |\s*)contain "(?P<html>.*)"$/
*/
public function theHtmlFieldShouldContain($locator, $negative, $html) {
$locator = MinkContext::fixStepArgument($locator);
$locator = $this->fixStepArgument($locator);
$page = $this->getSession()->getPage();
$element = $page->findField($locator);
assertNotNull($element, sprintf('HTML field "%s" not found', $locator));
@ -143,7 +154,7 @@ class CmsFormsContext extends BehatContext {
* @Given /^"(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field should(?P<negate>(?: not)?) be (?P<formatting>(.*))$/
*/
public function stepContentInHtmlFieldShouldHaveFormatting($text, $field, $negate, $formatting) {
$field = MinkContext::fixStepArgument($field);
$field = $this->fixStepArgument($field);
$page = $this->getSession()->getPage();
$inputField = $page->findField($field);
assertNotNull($inputField, sprintf('HTML field "%s" not found', $field));
@ -181,7 +192,7 @@ class CmsFormsContext extends BehatContext {
* @When /^I select "(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field$/
*/
public function stepIHighlightTextInHtmlField($text, $field) {
$field = MinkContext::fixStepArgument($field);
$field = $this->fixStepArgument($field);
$page = $this->getSession()->getPage();
$inputField = $page->findField($field);
assertNotNull($inputField, sprintf('HTML field "%s" not found', $field));