Esempio n. 1
0
/**
 * lib/bin-scripts/xref-ci.php
 *
 * "Continuous Integration Server"
 *
 * This script is to be run from command line (cron).
 * It checks for modified files in repository and reports about new errors.
 *
 * @author Igor Gariev <*****@*****.**>
 * @copyright Copyright (c) 2013 Igor Gariev
 * @licence http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
$includeDir = "@php_dir@" == "@" . "php_dir@" ? dirname(__FILE__) . "/.." : "@php_dir@/XRef";
require_once "{$includeDir}/XRef.class.php";
try {
    list($options, $arguments) = XRef::getCmdOptions();
} catch (Exception $e) {
    error_log($e->getMessage());
    error_log("See 'xref-ci --help'");
    exit(1);
}
if (XRef::needHelp() || count($arguments)) {
    XRef::showHelpScreen("xref-ci - continuous integration server");
    exit(1);
}
$incremental = XRef::getConfigValue("ci.incremental", false);
$xref = new XRef();
$xref->loadPluginGroup("lint");
$scm = $xref->getSourceCodeManager();
$storage = $xref->getStorageManager();
$exclude_paths = XRef::getConfigValue("project.exclude-path", array());
Esempio n. 2
0
 public function testConfigValue()
 {
     // reset and cache to empty (default) values
     list($options, $arguments) = XRef::getCmdOptions(array());
     // get config by value, save current settings
     $old_config_value = XRef::getConfig();
     $config = XRef::getConfig(true);
     $this->assertTrue(is_array($config));
     $this->assertTrue(!isset($config["foo.bar"]));
     $args = array("test.php", "-d", "foo.bar=true");
     list($options, $arguments) = XRef::getCmdOptions($args);
     $config = XRef::getConfig(true);
     $this->assertTrue(is_array($config));
     $this->assertTrue(isset($config["foo.bar"]));
     $this->assertTrue($config["foo.bar"]);
     $args = array("test.php", "-d", "f.b=true", "--define", "p=false", "-d", "x=y");
     list($options, $arguments) = XRef::getCmdOptions($args);
     $config = XRef::getConfig(true);
     $this->assertTrue(is_array($config));
     $this->assertTrue(!isset($config["foo.bar"]));
     $this->assertTrue(isset($config["f.b"]));
     $this->assertTrue(isset($config["p"]));
     $this->assertTrue(isset($config["x"]));
     $this->assertTrue($config["f.b"] === true);
     $this->assertTrue($config["p"] === false);
     $this->assertTrue($config["x"] === "y");
     // reset command-line options, restore value of the config
     list($options, $arguments) = XRef::getCmdOptions(array());
     $config_ref =& XRef::getConfig();
     $config_ref = $old_config_value;
 }