cvs: pear-core / test-modified.php

From: Date: Tue, 14 Apr 2009 01:49:10 +0000
Subject: cvs: pear-core / test-modified.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-8339@lists.php.net to get a copy of this message
cellog Tue Apr 14 01:49:10 2009 UTC Modified files: /pear-core test-modified.php Log: fix PEAR code detection, automatically CD to tests/ to run the tests, avoiding failures http://cvs.php.net/viewvc.cgi/pear-core/test-modified.php?r1=1.5&r2=1.6&diff_format=u Index: pear-core/test-modified.php diff -u pear-core/test-modified.php:1.5 pear-core/test-modified.php:1.6 --- pear-core/test-modified.php:1.5 Tue Apr 14 01:24:31 2009 +++ pear-core/test-modified.php Tue Apr 14 01:49:10 2009 @@ -73,7 +73,26 @@ error_reporting($e); } namespace PEAR2\Pyrus\Developer\CoverageAnalyzer { - $codepath = realpath(__DIR__); + $pear = @fopen('PEAR.php', 'r', 1); + if (!$pear) { + die("Install PEAR before attempting to run the tests\n"); + } + fclose($pear); + $olddir = getcwd(); +try_again: + foreach (explode(PATH_SEPARATOR, get_include_path()) as $includepath) { + if (file_exists($includepath . DIRECTORY_SEPARATOR . 'PEAR.php')) { + if ($includepath === '.') { + chdir('tests'); + goto try_again; + } + $codepath = $includepath; + break; + } + } + if (!isset($codepath)) { + die("Something is wrong - PEAR.php exists, but was not within include_path\n"); + } $testpath = realpath(__DIR__ . '/tests'); $sqlite = new Sqlite($testpath . '/pear2coverage.db', $codepath, $testpath); $modified = $sqlite->getModifiedTests(); @@ -88,6 +107,7 @@ chdir($testpath); error_reporting(0); $test->doRunTests('run-tests', array('coverage' => true), $modified); + chdir($olddir); error_reporting($e); chdir($dir); if (!$force && file_exists($testpath . '/run-tests.log')) {

« previous php.pear.core (#8339) next »