/** * @see LiveTest\Config\Tags\TestSuite.Base::doProcess() * * @fixme does not work if no Pages are added */ protected function doProcess(\LiveTest\Config\TestSuite $config, $testsuites) { foreach ($testsuites as $testsuite) { $filename = $testsuite['filename']; unset($testsuite['filename']); // @todo must be part of base library if (strpos($filename, '/') > 0) { $filename = $config->getBaseDir() . '/' . $filename; } try { $yaml = new Yaml($filename); } catch (\Exception $e) { throw new ConfigurationException("Error parsing included testsuite '" . $filename . "': " . $e->getMessage(), null, $e); } $testSuiteConfig = new TestSuite($config->getCurrentSession(), $config); $testSuiteConfig->setDefaultDomain($config->getDefaultDomain()); $parameters = $yaml->toArray(); $this->getParser()->parse($parameters, $testSuiteConfig); $this->getParser()->parse($testsuite, $testSuiteConfig); } }
/** * Creates a properties object that was created using a yaml file. * * @todo is this method neccessary? If yes: Where to put it? At the moment it is only used to make testing easier * * @param String $filename The file name of the yaml file * @param Uri $defaultUri The default uri */ public static function createByYamlFile($filename, Uri $defaultUri, Dispatcher $eventDispatcher) { try { $yamlConfig = new Yaml($filename); } catch (\Zend\Config\Exception $e) { throw new ConfigurationException('Unable to load test suite yaml file (filename: ' . $filename . ')'); } $testSuiteConfig = new TestSuite(); $testSuiteConfig->setBaseDir(dirname($filename)); $testSuiteConfig->setDefaultDomain($defaultUri); $parser = new Parser('LiveTest\\Config\\Tags\\TestSuite\\'); try { $testSuiteConfig = $parser->parse($yamlConfig->toArray(), $testSuiteConfig); } catch (UnknownTagException $e) { throw new ConfigurationException('Error parsing testsuite configuration (' . $filename . '): ' . $e->getMessage(), null, $e); } $testSuiteConfig->resolveSessionGroups(); $eventDispatcher->simpleNotify('LiveTest.TestRun.Properties.PostTestSuiteInit', array('config' => $testSuiteConfig)); return new self($testSuiteConfig, $defaultUri); }