Esempio n. 1
0
 public function __construct($name, $file)
 {
     $metadata = new Metadata();
     $metadata->setName($name);
     $metadata->setFilename($file);
     $this->setMetadata($metadata);
     $this->createScenario();
     $this->parser = new Parser($this->getScenario(), $this->getMetadata());
 }
Esempio n. 2
0
 public function __construct($testClass, $methodName, $fileName)
 {
     $metadata = new Metadata();
     $metadata->setName($methodName);
     $metadata->setFilename($fileName);
     $this->setMetadata($metadata);
     $this->testClassInstance = $testClass;
     $this->testMethod = $methodName;
     $this->createScenario();
     $this->parser = new Parser($this->getScenario(), $this->getMetadata());
 }
Esempio n. 3
0
 public function runStep(Step $step)
 {
     $this->steps[] = $step;
     $result = null;
     $this->metadata->getService('dispatcher')->dispatch(Events::STEP_BEFORE, new StepEvent($this->test, $step));
     try {
         $result = $step->run($this->metadata->getService('modules'));
     } catch (ConditionalAssertionFailed $f) {
         $result = $this->test->getTestResultObject();
         $result->addFailure(clone $this->test, $f, $result->time());
     } catch (\Exception $e) {
         $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step));
         throw $e;
     }
     $this->metadata->getService('dispatcher')->dispatch(Events::STEP_AFTER, new StepEvent($this->test, $step));
     $step->executed = true;
     return $result;
 }
Esempio n. 4
0
 public function attachMetadata($comments)
 {
     $this->metadata->setGroups(Annotation::fetchAllFromComment('group', $comments));
     $this->metadata->setEnv(Annotation::fetchAllFromComment('env', $comments));
     $this->metadata->setDependencies(Annotation::fetchAllFromComment('depends', $comments));
     $this->metadata->setSkip($this->firstOrNull(Annotation::fetchAllFromComment('skip', $comments)));
     $this->metadata->setIncomplete($this->firstOrNull(Annotation::fetchAllFromComment('incomplete', $comments)));
 }