context = $parameters; } /** * Get Mink session from MinkContext */ public function getSession($name = null) { return $this->getMainContext()->getSession($name); } /** * @Then /^I should see an edit page form$/ */ public function stepIShouldSeeAnEditPageForm() { $page = $this->getSession()->getPage(); $form = $page->find('css', '#Form_EditForm'); assertNotNull($form, 'I should see an edit page form'); } /** * @When /^I fill in the "(?P([^"]*))" HTML field with "(?P([^"]*))"$/ * @When /^I fill in "(?P([^"]*))" for the "(?P([^"]*))" HTML field$/ */ public function stepIFillInTheHtmlFieldWith($field, $value) { $page = $this->getSession()->getPage(); $inputField = $page->findField($field); assertNotNull($inputField, sprintf('HTML field "%s" not found', $field)); $this->getSession()->evaluateScript(sprintf( "jQuery('#%s').entwine('ss').getEditor().setContent('%s')", $inputField->getAttribute('id'), addcslashes($value, "'") )); } /** * @When /^I append "(?P([^"]*))" to the "(?P([^"]*))" HTML field$/ */ public function stepIAppendTotheHtmlField($field, $value) { $page = $this->getSession()->getPage(); $inputField = $page->findField($field); assertNotNull($inputField, sprintf('HTML field "%s" not found', $field)); $this->getSession()->evaluateScript(sprintf( "jQuery('#%s').entwine('ss').getEditor().insertContent('%s')", $inputField->getAttribute('id'), addcslashes($value, "'") )); } /** * @Then /^the "(?P([^"]*))" HTML field should contain "(?P([^"]*))"$/ */ public function theHtmlFieldShouldContain($field, $value) { $page = $this->getSession()->getPage(); $inputField = $page->findField($field); assertNotNull($inputField, sprintf('HTML field "%s" not found', $field)); $this->getMainContext()->assertElementContains('#' . $inputField->getAttribute('id'), $value); } }