예제 #1
0
 /**
  * Executes the text ui command and returns the exit code and the output as
  * an array <b>array($exitCode, $output)</b>.
  *
  * @param array $argv The cli parameters.
  *
  * @return array(mixed)
  */
 private function _executeCommand(array $argv = null)
 {
     $this->_prepareArgv($argv);
     ob_start();
     $exitCode = PHP_Depend_TextUI_Command::main();
     $output = ob_get_contents();
     ob_end_clean();
     return array($exitCode, $output);
 }
예제 #2
0
 /**
  * Main method that starts the command line runner.
  *
  * @return integer The exit code.
  */
 public static function main()
 {
     $command = new PHP_Depend_TextUI_Command();
     return $command->run();
 }
예제 #3
0
 * @copyright 2008-2012 Manuel Pichler. All rights reserved.
 * @license   http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version   SVN: $Id$
 * @link      http://pdepend.org/
 */
// PEAR/svn workaround
if (strpos('@php_bin@', '@php_bin') === 0) {
    set_include_path('.' . PATH_SEPARATOR . dirname(__FILE__) . '/../main/php');
}
require_once 'PHP/Depend/Autoload.php';
// Allow as much memory as possible by default
if (extension_loaded('suhosin') && is_numeric(ini_get('suhosin.memory_limit'))) {
    $limit = ini_get('memory_limit');
    if (preg_match('(^(\\d+)([BKMGT]))', $limit, $match)) {
        $shift = array('B' => 0, 'K' => 10, 'M' => 20, 'G' => 30, 'T' => 40);
        $limit = $match[1] * (1 << $shift[$match[2]]);
    }
    if (ini_get('suhosin.memory_limit') > $limit && $limit > -1) {
        ini_set('memory_limit', ini_get('suhosin.memory_limit'));
    }
} else {
    ini_set('memory_limit', -1);
}
// Disable E_STRICT for all PHP versions < 5.3.x
if (version_compare(phpversion(), '5.3.0')) {
    error_reporting(error_reporting() & ~E_STRICT);
}
$autoload = new PHP_Depend_Autoload();
$autoload->register();
exit(PHP_Depend_TextUI_Command::main());
 /**
  * testFullStackNotRunsEndless
  * 
  * @return void
  */
 public function testFullStackNotRunsEndless()
 {
     set_time_limit(5);
     $_SERVER['argv'] = array(__FILE__, '--summary-xml=' . $this->createRunResourceURI('jdepend.xml'), '--jdepend-xml=' . $this->createRunResourceURI('summary.xml'), $this->createCodeResourceUriForTest());
     ob_start();
     $command = new PHP_Depend_TextUI_Command();
     $command->run();
     $output = ob_get_clean();
     $this->assertContains(' is part of an endless inheritance hierarchy', $output);
 }
 /**
  * Executes PHP_Depend's text ui command and returns the exit code and shell
  * output.
  *
  * @return array
  */
 protected function runTextUICommand()
 {
     $command = new PHP_Depend_TextUI_Command();
     ob_start();
     $exitCode = $command->run();
     $output = ob_get_clean();
     return array($exitCode, $output);
 }