diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 371d0986..2dce078e 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -36,6 +36,9 @@ class FeatureContext extends \SilverStripe\Framework\Test\Behaviour\FeatureConte $fixtureContext->setFixtureFactory($this->getFixtureFactory()); $this->useContext('FixtureContext', $fixtureContext); + // Add extra contexts with more steps + $this->useContext('ThemeContext', new \SilverStripe\Cms\Test\Behaviour\ThemeContext($parameters)); + // Use blueprints which auto-publish all subclasses of SiteTree $factory = $fixtureContext->getFixtureFactory(); foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) { diff --git a/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/ThemeContext.php b/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/ThemeContext.php new file mode 100644 index 00000000..004586a7 --- /dev/null +++ b/tests/behat/features/bootstrap/SilverStripe/Cms/Test/Behaviour/ThemeContext.php @@ -0,0 +1,109 @@ +[^"]+)"/ + */ + public function stepCreateTheme($theme) { + if(!preg_match('/^[0-9a-zA-Z_-]+$/', $theme)) throw new \InvalidArgumentException("Bad theme '$theme'"); + + $this->requireDir(BASE_PATH . '/themes'); + $this->requireDir(BASE_PATH . '/themes/' . $theme); + $this->requireDir(BASE_PATH . '/themes/' . $theme . '/templates'); + } + + /** + * Create a template within a test theme + * + * @Given /^a template "(?