Exemplo n.º 1
0
 /**
  * If steps are combined into one method they can be reproduced as meta-step.
  * We are using stack trace to analyze if steps were called from test, if not - they were called from meta-step.
  *
  * @param $step
  * @param $stack
  */
 protected function addMetaStep($step, $stack)
 {
     if ($this->isTestFile($this->file) || $step['class'] == 'Codeception\\Scenario') {
         return;
     }
     $i = count($stack) - self::STACK_POSITION - 1;
     // get into test file and retrieve its actual call
     while (isset($stack[$i])) {
         $step = $stack[$i];
         $i--;
         if (!isset($step['file']) or !isset($step['function'])) {
             continue;
         }
         if (!$this->isTestFile($step['file'])) {
             continue;
         }
         $this->metaStep = new Meta($step['function'], array_values($step['params']));
         $this->metaStep->setTraceInfo($step['file'], $step['line']);
         // pageobjects or other classes should not be included with "I"
         if (!(new \ReflectionClass($step['class']))->isSubclassOf('Codeception\\Actor')) {
             $this->metaStep->setActor($step['class'] . ':');
         }
         return;
     }
 }