/** * Returns array of feature paths configured for the provided suite. * * @param Suite $suite * * @return string[] * * @throws SuiteConfigurationException If `paths` setting is not an array */ private function getSuitePaths(Suite $suite) { if (!is_array($suite->getSetting('paths'))) { throw new SuiteConfigurationException(sprintf('`paths` setting of the "%s" suite is expected to be an array, %s given.', $suite->getName(), gettype($suite->getSetting('paths'))), $suite->getName()); } return $suite->getSetting('paths'); }
private function prepare() { $em = $this->getService('models'); $em->generateAttributeModels(); //refresh s_core_templates $this->registerErrorHandler(); $this->getService('theme_installer')->synchronize(); restore_error_handler(); //get the template id $sql = sprintf('SELECT id FROM `s_core_templates` WHERE template = "%s"', self::$suite->getSetting('template')); $templateId = $this->getService('db')->fetchOne($sql); if (!$templateId) { throw new \RuntimeException(sprintf("Unable to find template by name %s", self::$suite->getSetting('template'))); } //set the template for shop "Deutsch" and activate SEPA payment method $sql = <<<EOD UPDATE `s_core_shops` SET `template_id`= {$templateId} WHERE `id` = 1; UPDATE `s_core_paymentmeans` SET `active`= 1; EOD; $this->getService('db')->exec($sql); Helper::setCurrentLanguage('de'); /** @var \Shopware\Bundle\PluginInstallerBundle\Service\InstallerService $pluginManager */ $pluginManager = $this->getService('shopware_plugininstaller.plugin_manager'); // hack to prevent behat error handler kicking in. $this->registerErrorHandler(); $pluginManager->refreshPluginList(); restore_error_handler(); $plugin = $pluginManager->getPluginByName('Notification'); $pluginManager->installPlugin($plugin); $pluginManager->activatePlugin($plugin); }
/** * {@inheritdoc} */ public function setupSuite(Suite $suite) { foreach ($suite->getSetting('paths') as $locator) { if (0 !== strpos($locator, '@') && !is_dir($path = $this->locatePath($locator))) { $this->createFeatureDirectory($path); } } }
private function getJavascriptSession(Suite $suite) { if (!$suite->hasSetting('mink_javascript_session')) { if (null === $this->javascriptSession) { throw new ProcessingException('The @javascript tag cannot be used without enabling a javascript session'); } return $this->javascriptSession; } $session = $suite->getSetting('mink_javascript_session'); if (!is_string($session)) { throw new SuiteConfigurationException(sprintf('`mink_javascript_session` setting of the "%s" suite is expected to be a string, %s given.', $suite->getName(), gettype($session)), $suite->getName()); } if (!in_array($session, $this->availableJavascriptSessions)) { throw new SuiteConfigurationException(sprintf('`mink_javascript_session` setting of the "%s" suite is not a javascript session. %s given but expected one of %s.', $suite->getName(), $session, implode(', ', $this->availableJavascriptSessions)), $suite->getName()); } return $session; }
/** * Returns array of context classes configured for the provided suite. * * @param Suite $suite * * @return string[] * * @throws SuiteConfigurationException If `contexts` setting is not an array */ private function getSuiteContexts(Suite $suite) { $contexts = $suite->getSetting('contexts'); if (!is_array($contexts)) { throw new SuiteConfigurationException(sprintf('`contexts` setting of the "%s" suite is expected to be an array, `%s` given.', $suite->getName(), gettype($contexts)), $suite->getName()); } return $contexts; }
/** * Returns list of filters from suite settings. * * @param Suite $suite * * @return FilterInterface[] */ private function getSuiteFilters(Suite $suite) { if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) { return array(); } $filters = array(); foreach ($suite->getSetting('filters') as $type => $filterString) { $filters[] = $this->createFilter($type, $filterString, $suite); } return $filters; }
public function initialize(Suite $suite, Spec $spec) { $this->mink->setDefaultSessionName($suite->getSetting('mink_session')); $this->mink->resetSessions(); }