/** * Updates test guy class. * * @since 1.0.0 * * @access public * @param SuiteEvent $e Event object. */ public function updateGuy(SuiteEvent $e) { $settings = $e->getSettings(); $guyFile = $settings['path'] . $settings['class_name'] . '.php'; // load guy class to see hash $handle = fopen($guyFile, "r"); if ($handle) { $line = fgets($handle); if (preg_match('~\\[STAMP\\] ([a-f0-9]*)~', $line, $matches)) { $hash = $matches[1]; $currentHash = Actor::genHash(SuiteManager::$actions, $settings); // regenerate guy class when hashes do not match if ($hash != $currentHash) { codecept_debug("Rebuilding {$settings['class_name']}..."); $guyGenerator = new Actor($settings); fclose($handle); $generated = $guyGenerator->produce(); file_put_contents($guyFile, $generated); return; } } fclose($handle); } }