Ejemplo n.º 1
0
 public function parseScenarioOptions($code)
 {
     $annotations = ['group', 'env', 'skip', 'incomplete', 'ignore'];
     $comments = $this->matchComments($code);
     foreach ($annotations as $annotation) {
         $values = Annotation::fetchAllFromComment($annotation, $comments);
         foreach ($values as $value) {
             call_user_func([$this->scenario, $annotation], $value);
         }
     }
     // deprecated - parsing $scenario->xxx calls
     $metaData = ['group', 'env'];
     $phpCode = $this->stripComments($code);
     $scenario = $this->scenario;
     $feature = $scenario->getFeature();
     foreach ($metaData as $call) {
         $res = preg_match_all("~\\\$scenario->{$call}.*?;~", $phpCode, $matches);
         if (!$res) {
             continue;
         }
         foreach ($matches[0] as $line) {
             // run $scenario->group or $scenario->env
             \Codeception\Lib\Deprecation::add("\$scenario->{$call}() is deprecated in favor of annotation: // @{$call}", $this->scenario->getFeature());
             eval($line);
         }
     }
 }
Ejemplo n.º 2
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)));
 }
Ejemplo n.º 3
0
 public function attachMetadata($comments)
 {
     $annotations = ['group', 'env', 'skip', 'incomplete', 'ignore'];
     foreach ($annotations as $annotation) {
         $values = Annotation::fetchAllFromComment($annotation, $comments);
         foreach ($values as $value) {
             call_user_func([$this->scenario, $annotation], $value);
         }
     }
 }