GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Codeception/ext/DotReporter.php at main · Codeception/Codeception Expand file tree/ Copy pathDotReporter.phpMore file actions 125 lines (107 loc) · 2.97 KB / Copy pathDotReporter.phpFile metadata and controls125 lines (107 loc) · 2.97 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 <?php declare(strict_types=1); namespace Codeception\Extension; use Codeception\Event\FailEvent; use Codeception\Event\PrintResultEvent; use Codeception\Event\TestEvent; use Codeception\Events; use Codeception\Extension; use Codeception\Subscriber\Console as CodeceptConsole; /** * DotReporter provides less verbose output for test execution. * Like PHPUnit printer it prints dots "." for successful tests and "F" for failures. * *  * * ```bash * .......... * .......... * .......... * .......... * .......... * .......... * .......... * .......... * * Time: 2.07 seconds, Memory: 20.00MB * * OK (80 tests, 124 assertions) * ``` * * * Enable this reporter with `--ext option` * * ``` * codecept run --ext DotReporter * ``` * * Failures and Errors are printed by a standard Codeception reporter. * Use this extension as an example for building custom reporters. */ class DotReporter extends Extension { protected ?CodeceptConsole $standardReporter = null; protected array $errors = []; protected array $failures = []; protected int $width = 10; protected int $currentPos = 0; public function _initialize(): void { $this->_reconfigure(['settings' => ['silent' => true]]); // turn off printing for everything else $this->standardReporter = new CodeceptConsole($this->options); $this->width = $this->standardReporter->detectWidth(); } /** * We are listening for events * * @var array<string, string> */ public static array $events = [ Events::SUITE_BEFORE => 'beforeSuite', Events::TEST_SUCCESS => 'success', Events::TEST_FAIL => 'fail', Events::TEST_ERROR => 'error', Events::TEST_SKIPPED => 'skipped', Events::TEST_FAIL_PRINT => 'printFailed', Events::RESULT_PRINT_AFTER => 'afterResult', ]; public function beforeSuite(): void { $this->output->writeln(''); } public function success(): void { $this->printChar('.'); } public function fail(FailEvent $event): void { $this->printChar('<error>F</error>'); } public function error(FailEvent $event): void { $this->printChar('<error>E</error>'); } public function skipped(): void { $this->printChar('S'); } protected function printChar(string $char): void { if ($this->currentPos >= $this->width) { $this->output->writeln(''); $this->currentPos = 0; } $this->write($char); ++$this->currentPos; } public function printFailed(FailEvent $event): void { $this->standardReporter->printFail($event); } public function afterResult(PrintResultEvent $event): void { $this->output->writeln(''); $this->output->writeln(''); $this->standardReporter->afterResult($event); } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |