Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/codeception/codeception/ext/ |
Upload File : |
<?php namespace Codeception\Extension; use Codeception\Event\PrintResultEvent; use Codeception\Events; use Codeception\Extension; use Codeception\Test\Descriptor; /** * Saves failed tests into tests/_output/failed in order to rerun failed tests. * * To rerun failed tests just run the `failed` group: * * ``` * php codecept run -g failed * ``` * * To change failed group name add: * ``` * --override "extensions: config: Codeception\Extension\RunFailed: fail-group: another_group1" * ``` * Remember: if you run tests and they generated custom-named fail group, to run this group, you should add override too * * Starting from Codeception 2.1 **this extension is enabled by default**. * * ``` yaml * extensions: * enabled: [Codeception\Extension\RunFailed] * ``` * * On each execution failed tests are logged and saved into `tests/_output/failed` file. */ class RunFailed extends Extension { public static $events = [ Events::RESULT_PRINT_AFTER => 'saveFailed' ]; /** @var string filename/groupname for failed tests */ protected $group = 'failed'; public function _initialize() { if (array_key_exists('fail-group', $this->config) && $this->config['fail-group']) { $this->group = $this->config['fail-group']; } $logPath = str_replace($this->getRootDir(), '', $this->getLogDir()); // get local path to logs $this->_reconfigure(['groups' => [$this->group => $logPath . $this->group]]); } public function saveFailed(PrintResultEvent $e) { $file = $this->getLogDir() . $this->group; $result = $e->getResult(); if ($result->wasSuccessful()) { if (is_file($file)) { unlink($file); } return; } $output = []; foreach ($result->failures() as $fail) { $output[] = $this->localizePath(Descriptor::getTestFullName($fail->failedTest())); } foreach ($result->errors() as $fail) { $output[] = $this->localizePath(Descriptor::getTestFullName($fail->failedTest())); } file_put_contents($file, implode("\n", $output)); } protected function localizePath($path) { $root = realpath($this->getRootDir()) . DIRECTORY_SEPARATOR; if (substr($path, 0, strlen($root)) == $root) { return substr($path, strlen($root)); } return $path; } }