|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / vendor / codeception / codeception / ext / |
Filename | /home/dev2.destoffenstraat.com/vendor/codeception/codeception/ext/SimpleReporter.php |
Size | 1.64 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 13-Mar-2022 18:07 |
Last accessed | 21-Aug-2025 22:34 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace Codeception\Extension;
use Codeception\Event\TestEvent;
use Codeception\Events;
use Codeception\Extension;
use Codeception\Test\Descriptor;
/**
* This extension demonstrates how you can implement console output of your own.
* Recommended to be used for development purposes only.
*/
class SimpleReporter extends Extension
{
public function _initialize()
{
$this->options['silent'] = false; // turn on printing for this extension
$this->_reconfigure(['settings' => ['silent' => true]]); // turn off printing for everything else
}
// we are listening for events
public static $events = [
Events::SUITE_BEFORE => 'beforeSuite',
Events::TEST_END => 'after',
Events::TEST_SUCCESS => 'success',
Events::TEST_FAIL => 'fail',
Events::TEST_ERROR => 'error',
];
public function beforeSuite()
{
$this->writeln("");
}
public function success()
{
$this->write('[+] ');
}
public function fail()
{
$this->write('[-] ');
}
public function error()
{
$this->write('[E] ');
}
// we are printing test status and time taken
public function after(TestEvent $e)
{
$seconds_input = $e->getTime();
// stack overflow: http://stackoverflow.com/questions/16825240/how-to-convert-microtime-to-hhmmssuu
$seconds = (int)($milliseconds = (int)($seconds_input * 1000)) / 1000;
$time = ($seconds % 60) . (($milliseconds === 0) ? '' : '.' . $milliseconds);
$this->write(Descriptor::getTestSignature($e->getTest()));
$this->writeln(' (' . $time . 's)');
}
}
namespace Codeception\Extension;
use Codeception\Event\TestEvent;
use Codeception\Events;
use Codeception\Extension;
use Codeception\Test\Descriptor;
/**
* This extension demonstrates how you can implement console output of your own.
* Recommended to be used for development purposes only.
*/
class SimpleReporter extends Extension
{
public function _initialize()
{
$this->options['silent'] = false; // turn on printing for this extension
$this->_reconfigure(['settings' => ['silent' => true]]); // turn off printing for everything else
}
// we are listening for events
public static $events = [
Events::SUITE_BEFORE => 'beforeSuite',
Events::TEST_END => 'after',
Events::TEST_SUCCESS => 'success',
Events::TEST_FAIL => 'fail',
Events::TEST_ERROR => 'error',
];
public function beforeSuite()
{
$this->writeln("");
}
public function success()
{
$this->write('[+] ');
}
public function fail()
{
$this->write('[-] ');
}
public function error()
{
$this->write('[E] ');
}
// we are printing test status and time taken
public function after(TestEvent $e)
{
$seconds_input = $e->getTime();
// stack overflow: http://stackoverflow.com/questions/16825240/how-to-convert-microtime-to-hhmmssuu
$seconds = (int)($milliseconds = (int)($seconds_input * 1000)) / 1000;
$time = ($seconds % 60) . (($milliseconds === 0) ? '' : '.' . $milliseconds);
$this->write(Descriptor::getTestSignature($e->getTest()));
$this->writeln(' (' . $time . 's)');
}
}