diff --git a/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/FixtureContext.php b/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/FixtureContext.php index 58572fb1..a2c20914 100644 --- a/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/FixtureContext.php +++ b/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/FixtureContext.php @@ -21,45 +21,12 @@ require_once 'PHPUnit/Framework/Assert/Functions.php'; */ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext { - protected $context; - - /** - * @var FixtureFactory - */ - protected $fixtureFactory; - - public function __construct(array $parameters) - { - $this->context = $parameters; - } - - public function getSession($name = null) - { - return $this->getMainContext()->getSession($name); - } - - /** - * @return \FixtureFactory - */ - public function getFixtureFactory() { - if(!$this->fixtureFactory) { - $this->fixtureFactory = \Injector::inst()->get('FixtureFactory', 'FixtureContextFactory'); - } - return $this->fixtureFactory; - } - - /** - * @param \FixtureFactory $factory - */ - public function setFixtureFactory(\FixtureFactory $factory) { - $this->fixtureFactory = $factory; - } /** * Find or create a redirector page and link to another existing page. - * Example: Given a page "My Redirect" which redirects to a page "Page 1" + * Example: Given a "page" "My Redirect" which redirects to a "page" "Page 1" * - * @Given /^(?:(an|a|the) )(?[^"]+)"(?[^"]+)" (:?which )?redirects to (?:(an|a|the) )(?[^"]+)"(?[^"]+)"$/ + * @Given /^(?:(an|a|the) )"(?[^"]+)" "(?[^"]+)" (:?which )?redirects to (?:(an|a|the) )"(?[^"]+)" "(?[^"]+)"$/ */ public function stepCreateRedirectorPage($type, $id, $targetType, $targetId) { @@ -80,31 +47,4 @@ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext $obj->publish('Stage', 'Live'); } - /** - * Converts a natural language class description to an actual class name. - * Respects {@link DataObject::$singular_name} variations. - * Example: "redirector page" -> "RedirectorPage" - * - * @param String - * @return String Class name - */ - protected function convertTypeToClass($type) { - // Try direct mapping - $class = str_replace(' ', '', ucfirst($type)); - if(class_exists($class) || !is_subclass_of($class, 'DataObject')) { - return $class; - } - - // Fall back to singular names - foreach(array_values(\ClassInfo::subclassesFor('DataObject')) as $candidate) { - if(singleton($candidate)->singular_name() == $type) return $candidate; - } - - throw new \InvalidArgumentException(sprintf( - 'Class "%s" does not exist, or is not a subclass of DataObjet', - $class - )); - } - - } diff --git a/tests/behat/features/edit-a-page.feature b/tests/behat/features/edit-a-page.feature index c29474f4..8fd20bf0 100644 --- a/tests/behat/features/edit-a-page.feature +++ b/tests/behat/features/edit-a-page.feature @@ -4,7 +4,7 @@ Feature: Edit a page So that I correct errors and provide new information Background: - Given a page "About Us" + Given a "page" "About Us" Given I am logged in with "ADMIN" permissions And I go to "/admin/pages" Then I should see "About Us" in CMS Tree diff --git a/tests/behat/features/preview-a-page.feature b/tests/behat/features/preview-a-page.feature index 4d4013ba..6038b84f 100644 --- a/tests/behat/features/preview-a-page.feature +++ b/tests/behat/features/preview-a-page.feature @@ -4,7 +4,7 @@ Feature: Preview a page So that I can see how it would look like to my visitors Background: - Given a page "About Us" + Given a "page" "About Us" @javascript Scenario: I can show a preview of the current page from the pages section @@ -28,7 +28,7 @@ Feature: Preview a page When I follow "About Us" And I fill in the "Content" HTML field with "my new content" - And I press the "Save Draft" button + And I press the "Save draft" button And I press the "Preview ยป" button When I follow "Published Site" diff --git a/tests/behat/features/search-for-a-page.feature b/tests/behat/features/search-for-a-page.feature index 267dbacb..46ad3fec 100644 --- a/tests/behat/features/search-for-a-page.feature +++ b/tests/behat/features/search-for-a-page.feature @@ -4,8 +4,8 @@ Feature: Search for a page So that I can efficiently navigate nested content structures Background: - Given a page "About Us" - And a page "Contact Us" + Given a "page" "About Us" + And a "page" "Contact Us" @javascript Scenario: I can search for a page by its title