isEmpty() public méthode

public isEmpty ( )
Exemple #1
0
    --coverage-src <path>  Path to source code.
    -h | --help            This help.

XX
, array('-c' => array(Cmd::REALPATH => TRUE), '--watch' => array(Cmd::REPEATABLE => TRUE, Cmd::REALPATH => TRUE), '--setup' => array(Cmd::REALPATH => TRUE), 'paths' => array(Cmd::REPEATABLE => TRUE, Cmd::VALUE => getcwd()), '--debug' => array(), '--coverage-src' => array(Cmd::REALPATH => TRUE)));
if (isset($_SERVER['argv']) && ($tmp = array_search('-log', $_SERVER['argv']))) {
    $_SERVER['argv'][$tmp] = '--log';
}
$options = $cmd->parse();
Tester\Environment::$debugMode = (bool) $options['--debug'];
if (isset($options['--colors'])) {
    Tester\Environment::$useColors = (bool) $options['--colors'];
} elseif ($options['--tap']) {
    Tester\Environment::$useColors = FALSE;
}
if ($cmd->isEmpty() || $options['--help']) {
    $cmd->help();
    exit;
}
$phpArgs = '';
if ($options['-c']) {
    $phpArgs .= ' -c ' . Tester\Helpers::escapeArg($options['-c']);
} elseif (!$options['--info']) {
    echo "Note: No php.ini is used.\n";
}
foreach ($options['-d'] as $item) {
    $phpArgs .= ' -d ' . Tester\Helpers::escapeArg($item);
}
$php = new Tester\Runner\PhpExecutable($options['-p'], $phpArgs);
if ($options['--info']) {
    $job = new Tester\Runner\Job(__DIR__ . '/Runner/info.php', $php);
Exemple #2
0
<?php

/**
 * Code coverage HTML report generator.
 *
 * This file is part of the Nette Tester.
 */
require __DIR__ . '/CodeCoverage/ReportGenerator.php';
require __DIR__ . '/Runner/CommandLine.php';
use Tester\Runner\CommandLine as Cmd;
$cmd = new Cmd("\nCode coverage HTML report generator\n-----------------------------------\n\nUsage:\n\tphp coverage-report.php [options]\n\nOptions:\n\t-c <path>    coverage.dat file (default: coverage.dat)\n\t-s <path>    directory with source code\n\t-o <path>    output file (default: coverage.html)\n\t-t <title>   title of generated documentation\n\t-h | --help  this help\n\n", array('-c' => array(Cmd::REALPATH), '-s' => array(Cmd::REALPATH)));
$options = $cmd->parse();
if ($cmd->isEmpty()) {
    $cmd->help();
} elseif ($options['--help']) {
    $cmd->help();
    exit;
}
try {
    $generator = new ReportGenerator($options['-c'], $options['-s'], $options['-t']);
    if ($options['-o'] === '-') {
        $generator->render();
    } else {
        echo "Generating report to {$options['-o']}\n";
        $generator->render($options['-o']);
        echo "Done.\n";
    }
} catch (Exception $e) {
    echo "Error: {$e->getMessage()}\n";
    die(254);
}