public function __toString() { $mark = $this->success === true ? CLI::color("green", "✔") : CLI::color("red", "✘"); $expectation = CLI::color("grey", $this->expectation); return " {$mark} {$expectation}\n"; }
/** * Run all tests. */ public function run() { echo CLI::color("blue", "\nLimerence "); echo CLI::color("grey", "v{$this->version}\n"); echo "\nTests:\n‾‾‾‾‾‾"; $time = microtime(); foreach ($this->testSuites as $testSuite) { $this->testSuite = $testSuite; $this->testSuite->gatherTestCases(); } foreach ($this->testSuites as $testSuite) { $this->testSuite = $testSuite; $this->testSuite->run(); } if ($this->errors) { echo CLI::color("red", "\n\nErrors:\n‾‾‾‾‾‾‾\n"); foreach ($this->errors as $error) { echo "{$error}\n\n"; } } $this->time = microtime() - $time; $numberOfTests = $this->passing + $this->failing; echo "\n\n{$numberOfTests} tests ({$this->assertions} assertions) completed in " . number_format($this->time, 2) . " ms.\n\n"; echo CLI::color("green", "{$this->passing} tests passing.\n"); echo CLI::color("red", "{$this->failing} tests failing.\n\n"); }
/** * Get the error as a string. * * @return string */ public function __toString() { return CLI::color("grey", " {$this->description}\n") . " – {$this->message}"; }