src.dualinventive.com/dinet/libdi-php/common/ditest-php/DiTestMessage.php

55 lines
2.0 KiB
PHP

<?php
class DiTestMsg {
public static function run($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ RUN ]", "yellow") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function pass($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ PASS ]", "green") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function fail($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ FAIL ]", "red") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function warn($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ WARN ]", "magenta") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function err($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ ERR ]", "red") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function dbg($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ DBG ]", "bold") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function info($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ INFO ]", "cyan") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function user($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ USER ]", "black+yellow_bg") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function skip($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ SKIP ]", "white+red_bg") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function wait($msg, $component = "") {
DiTestMsg::__write(DiTestColor::set("[ WAIT ]", "blink+bold+white+black_bg") . DiTestMsg::__getComponentStr($component) . $msg);
}
public static function __getComponentStr($component) {
if ($component != "") {
return " [" . $component . "] ";
}
return " ";
}
public static function __write($msg) {
fwrite(STDOUT, $msg . PHP_EOL);
}
}