/**
  * \brief test for cli_logger 
  */
 function testcli_logger()
 {
     print "Start unit test for common-cli.php\n";
     print "test function cli_logger()\n";
     $data = "test for cli log";
     cli_logger("./cli.log", $data, "w");
     $file_contents = file_get_contents("./cli.log");
     $this->assertEquals("{$data}\n", $file_contents);
     cli_logger("./cli.log", $data, "a");
     $file_contents = file_get_contents("./cli.log");
     $this->assertEquals("{$data}\n{$data}\n", $file_contents);
     cli_logger("./cli.log", $data, "w");
     $file_contents = file_get_contents("./cli.log");
     $this->assertEquals("{$data}\n", $file_contents);
     print "unit test for common-cli.php end\n";
 }
Exemple #2
0
function save_skipped($path, $message)
{
    global $WEBDIR;
    require_once "{$WEBDIR}/common/common-cli.php";
    // save the message containing the package name that failed in a file at $path
    $logged = cli_logger($path, $message);
    if (!empty($logged)) {
        return $logged;
    }
    return NULL;
}