Exemplo n.º 1
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     $config->getCurrentSession()->doNotInherit();
     foreach ($parameters as $file) {
         $config->getCurrentSession()->includePageRequests(Request::createRequestsFromParameters(file($config->getBaseDir() . '/' . $file), $config->getDefaultDomain()));
     }
 }
Exemplo n.º 2
0
 /**
  *
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     foreach ($parameters as $testCaseName => $value) {
         if (array_key_exists('Parameter', $value)) {
             $testParameters = $value['Parameter'];
             unset($value['Parameter']);
         } else {
             $testParameters = array();
         }
         if (array_key_exists('FailOnError', $value)) {
             if ($value['FailOnError'] == 'true') {
                 $failOnError = true;
             } else {
                 if ($value['FailOnError'] == 'false') {
                     $failOnError = false;
                 } else {
                     throw new ConfigurationException('FailOnError must be true or false, ' . $value['FailOnError'] . "was given");
                 }
             }
             unset($value['FailOnError']);
         } else {
             $failOnError = false;
         }
         $config->createTestCase($testCaseName, $value['TestCase'], $testParameters, $failOnError);
         unset($value['TestCase']);
         $this->getParser()->parse($value, $config);
     }
 }
Exemplo n.º 3
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     foreach ($parameters as $file) {
         $yaml = new Yaml($config->getBaseDir() . '/' . $file);
         $this->getParser()->parse($yaml->toArray(), $config);
     }
 }
Exemplo n.º 4
0
 protected function doProcess(\LiveTest\Config\TestSuite $config, $sessionNames)
 {
     $testCaseConfig = $config->getCurrentTestCaseConfig();
     foreach ($sessionNames as $sessionName) {
         $testCaseConfig->addSession($sessionName);
     }
 }
Exemplo n.º 5
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(TestSuiteConfig $config, $manipulators)
 {
     foreach ($manipulators as $manipulator) {
         $manipulatorObject = new $manipulator();
         $config->addPageManipulator($manipulatorObject);
     }
 }
Exemplo n.º 6
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(TestSuiteConfig $config, $sessionFiles)
 {
     foreach ($sessionFiles as $sessionFile) {
         $yaml = new Yaml($config->getBaseDir() . '/' . $sessionFile);
         $this->getParser()->parse($yaml->toArray(), $config);
     }
 }
Exemplo n.º 7
0
 public function testUnknownTag()
 {
     $config = new TestSuite();
     $config->setBaseDir(__DIR__ . '/fixtures/');
     $configYaml = new Yaml(__DIR__ . '/fixtures/badtestsuite.yml');
     $parser = new Parser('LiveTest\\Config\\Tags\\TestSuite\\');
     $this->setExpectedException('LiveTest\\Config\\Parser\\UnknownTagException');
     $parsedConfig = $parser->parse($configYaml->toArray(), $config);
 }
Exemplo n.º 8
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     $requests = SymfonyRequest::createRequestsFromParameters($parameters, $config->getDefaultDomain());
     if ($config->hasSessions()) {
         $config->getCurrentSession()->includePageRequests($requests);
     } else {
         throw new ConfigurationException('You can not use the Page tag outside a session tag.');
     }
 }
Exemplo n.º 9
0
 public function testCreateTestCase()
 {
     $config = new TestSuite();
     $config->createTestCase('MyTestCase', 'MyClassName', array('foo' => 'bar'));
     $config->createTestCase('MyTestCase2', 'MyClassName2', array('foo' => 'bar'));
     $testCases = $config->getTestCases();
     $this->assertEquals(2, count($testCases));
     $this->assertEquals('MyClassName', $testCases['MyTestCase']->getClassName());
     //     $this->assertNotEquals($newConfig, $config);
 }
Exemplo n.º 10
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(TestSuiteConfig $config, $sessioNames)
 {
     $currentSession = $config->getCurrentSession();
     foreach ($sessioNames as $sessionName) {
         if ($config->hasSession($sessionName)) {
             $currentSession->extendSession($config->getSession($sessionName));
         } else {
             throw new ConfigurationException("Can't extend an undefined session (" . $sessionName . "). Sessions must be defined before they can be used.");
         }
     }
 }
Exemplo n.º 11
0
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     foreach ($parameters as $file) {
         // @todo base dir must be set. Would be a conflict if the standard config is overwritten.
         $filename = $config->getBaseDir() . DIRECTORY_SEPARATOR . $file;
         try {
             // @todo yaml dependency must be replaced. It must be possible to use xml as well.
             $yamlFile = new Yaml($filename);
         } catch (InvalidArgumentException $e) {
             throw new ConfigurationException('The included testsuite configuration file ("' . $filename . '") was not found.', null, $e);
         }
         $this->getParser()->parse($yamlFile->toArray(), $config);
     }
 }
Exemplo n.º 12
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     foreach ($parameters as $testCaseName => $value) {
         if (array_key_exists('Parameter', $value)) {
             $testParameters = $value['Parameter'];
             unset($value['Parameter']);
         } else {
             $testParameters = array();
         }
         $config->createTestCase($testCaseName, $value['TestCase'], $testParameters);
         unset($value['TestCase']);
         $this->getParser()->parse($value, $config);
     }
 }
Exemplo n.º 13
0
 /**
  * Returns the base directory of the config file.
  *
  * @return string
  */
 public function getBaseDir()
 {
     if (is_null($this->baseDir)) {
         return $this->parentConfig->getBaseDir();
     }
     return $this->baseDir;
 }
Exemplo n.º 14
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $sessions)
 {
     // @todo $hasDefaultSession = false;
     foreach ($sessions as $sessionName => $sessionParameter) {
         if (array_key_exists('AllowCookies', $sessionParameter)) {
             $allowCookies = $sessionParameter['AllowCookies'];
         } else {
             $allowCookies = false;
         }
         $session = new Session($allowCookies);
         $config->addSession($sessionName, $session);
         $config->setCurrentSession($sessionName);
         unset($sessionParameter['AllowCookies']);
         $parser = $this->getParser()->parse($sessionParameter, $config);
     }
 }
Exemplo n.º 15
0
 /**
  * @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);
     }
 }
Exemplo n.º 16
0
 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     $config->getCurrentSession()->excludePageRequests(Request::createRequestsFromParameters($parameters, $config->getDefaultDomain()));
 }
Exemplo n.º 17
0
 /**
  * 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);
 }
Exemplo n.º 18
0
 /**
  *
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $sessions)
 {
     foreach ($sessions as $sessionGroupName => $sessionNames) {
         $config->addSessionGroup($sessionGroupName, $sessionNames);
     }
 }