public function runStep(\Codeception\Step $step) { $this->trace[] = $step; if ($step->getName() == 'Comment') { $this->dispatcher->dispatch('comment.before', new \Codeception\Event\Step($this, $step)); $this->dispatcher->dispatch('comment.after', new \Codeception\Event\Step($this, $step)); return; } $action = $step->getAction(); $arguments = $step->getArguments(); if (!isset(\Codeception\SuiteManager::$actions[$action])) { $this->stopped = true; $this->fail("Action {$action} not defined"); return; } $this->dispatcher->dispatch('step.before', new \Codeception\Event\Step($this, $step)); $activeModule = \Codeception\SuiteManager::$modules[\Codeception\SuiteManager::$actions[$action]]; try { if (is_callable(array($activeModule, $action))) { call_user_func_array(array($activeModule, $action), $arguments); } else { throw new \RuntimeException("Action can't be called"); } } catch (\PHPUnit_Framework_ExpectationFailedException $fail) { $this->dispatcher->dispatch('step.after', new \Codeception\Event\Step($this, $step)); throw $fail; } $this->dispatcher->dispatch('step.after', new \Codeception\Event\Step($this, $step)); }
/** * After each step * * @param Step $step */ public function _afterStep(Step $step) { if ($step->getAction() === 'seeNoDifferenceToReferenceImage') { // cleanup the temp image if (file_exists($this->moduleFileSystemUtil->getTempImagePath($step->getArguments()[0]))) { @unlink($this->moduleFileSystemUtil->getTempImagePath($step->getArguments()[0])); } } }