public function testFormat() { $formatter = new \r8\Error\Formatter\HTML(\r8\Env::request()); $exception = new \r8\Exception("Test", 5050); $exception->addData("key", "data"); $exception->addData("test", new stdClass()); $error = new \r8\Error\Exception($exception); $result = $formatter->format($error); $this->assertType("string", $result); $this->assertGreaterThan(0, strlen($result)); }
/** * Returns a string about this exception * * @return String */ public function __toString() { if (\r8\Env::request()->isCLI()) { $formatter = new \r8\Error\Formatter\Text(\r8\Env::request()); } else { $formatter = new \r8\Error\Formatter\HTML(\r8\Env::request()); } return $formatter->format($this); }