mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix static call to protected instance method
This commit is contained in:
parent
dc919dc3d9
commit
49cb38dfc1
@ -44,6 +44,17 @@ class CmsFormsContext extends BehatContext {
|
|||||||
return $this->getMainContext()->getSession($name);
|
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$/
|
* @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$/
|
* @When /^I fill in "(?P<value>(?:[^"]|\\")*)" for the "(?P<field>(?:[^"]|\\")*)" HTML field$/
|
||||||
*/
|
*/
|
||||||
public function stepIFillInTheHtmlFieldWith($field, $value) {
|
public function stepIFillInTheHtmlFieldWith($field, $value) {
|
||||||
$field = MinkContext::fixStepArgument($field);
|
$field = $this->fixStepArgument($field);
|
||||||
$value = MinkContext::fixStepArgument($value);
|
$value = $this->fixStepArgument($value);
|
||||||
|
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$inputField = $page->findField($field);
|
$inputField = $page->findField($field);
|
||||||
@ -81,8 +92,8 @@ class CmsFormsContext extends BehatContext {
|
|||||||
* @When /^I append "(?P<value>(?:[^"]|\\")*)" to the "(?P<field>(?:[^"]|\\")*)" HTML field$/
|
* @When /^I append "(?P<value>(?:[^"]|\\")*)" to the "(?P<field>(?:[^"]|\\")*)" HTML field$/
|
||||||
*/
|
*/
|
||||||
public function stepIAppendTotheHtmlField($field, $value) {
|
public function stepIAppendTotheHtmlField($field, $value) {
|
||||||
$field = MinkContext::fixStepArgument($field);
|
$field = $this->fixStepArgument($field);
|
||||||
$value = MinkContext::fixStepArgument($value);
|
$value = $this->fixStepArgument($value);
|
||||||
|
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$inputField = $page->findField($field);
|
$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>.*)"$/
|
* @Then /^the "(?P<locator>(?:[^"]|\\")*)" HTML field should(?P<negative> not? |\s*)contain "(?P<html>.*)"$/
|
||||||
*/
|
*/
|
||||||
public function theHtmlFieldShouldContain($locator, $negative, $html) {
|
public function theHtmlFieldShouldContain($locator, $negative, $html) {
|
||||||
$locator = MinkContext::fixStepArgument($locator);
|
$locator = $this->fixStepArgument($locator);
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$element = $page->findField($locator);
|
$element = $page->findField($locator);
|
||||||
assertNotNull($element, sprintf('HTML field "%s" not found', $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>(.*))$/
|
* @Given /^"(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field should(?P<negate>(?: not)?) be (?P<formatting>(.*))$/
|
||||||
*/
|
*/
|
||||||
public function stepContentInHtmlFieldShouldHaveFormatting($text, $field, $negate, $formatting) {
|
public function stepContentInHtmlFieldShouldHaveFormatting($text, $field, $negate, $formatting) {
|
||||||
$field = MinkContext::fixStepArgument($field);
|
$field = $this->fixStepArgument($field);
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$inputField = $page->findField($field);
|
$inputField = $page->findField($field);
|
||||||
assertNotNull($inputField, sprintf('HTML field "%s" not found', $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$/
|
* @When /^I select "(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field$/
|
||||||
*/
|
*/
|
||||||
public function stepIHighlightTextInHtmlField($text, $field) {
|
public function stepIHighlightTextInHtmlField($text, $field) {
|
||||||
$field = MinkContext::fixStepArgument($field);
|
$field = $this->fixStepArgument($field);
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$inputField = $page->findField($field);
|
$inputField = $page->findField($field);
|
||||||
assertNotNull($inputField, sprintf('HTML field "%s" not found', $field));
|
assertNotNull($inputField, sprintf('HTML field "%s" not found', $field));
|
||||||
|
Loading…
Reference in New Issue
Block a user