[^"]+)" "(?[^"]+)" (:?which )?redirects to (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"$/ */ public function stepCreateRedirectorPage($type, $id, $targetType, $targetId) { $class = 'RedirectorPage'; $targetClass = $this->convertTypeToClass($targetType); $targetObj = $this->fixtureFactory->get($targetClass, $targetId); if (!$targetObj) $targetObj = $this->fixtureFactory->get($targetClass, $targetId); $fields = array('LinkToID' => $targetObj->ID); $obj = $this->fixtureFactory->get($class, $id); if ($obj) { $obj->update($fields); } else { $obj = $this->fixtureFactory->createObject($class, $id, $fields); } $obj->write(); $obj->publish('Stage', 'Live'); } /** * * Check if the user can edit a page * * Example: Then pages should be editable by "Admin" * Then pages should not be editable by "Admin" * * @Then /^pages should( not? |\s*)be editable by "([^"]*)"$/ */ public function pagesShouldBeEditableBy($negative, $member){ $page = \Page::get()->First(); return array( new Step\Given('I am not logged in'), new Step\Given('I am logged in with "' . $member . '" permissions'), new Step\Given('I go to "/admin/pages/edit/show/' . $page->ID . '"'), new Step\Given('I should' . $negative . 'see a "Page name" field'), new Step\Then('I am on the homepage') ); } }