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); } } }
public function parseScenarioOptions($code) { $comments = $this->matchComments($code); $this->attachMetadata($comments); // 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); } } }
public function running() { \Codeception\Lib\Deprecation::add("Scenario is always running. Please remove \$scenario->running() call.", $this->getFeature()); return true; }
public function afterSuite(SuiteEvent $e) { $this->message()->width(array_sum($this->columns), '-')->writeln(); $deprecationMessages = Deprecation::all(); foreach ($deprecationMessages as $message) { $this->output->deprecate($message); } }