g2 Thu May 7 20:58:45 2009 UTC
Modified files:
/phpruntests/src/configuration/preconditions
rtIsPhpVersionCorrect.php
/phpruntests/src run-tests.php
Log:
phpruntests: added php-version-check to run-tests.php
http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php?r1=1.1&r2=1.2&diff_format=u
Index: phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php
diff -u
phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php:1.1
phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php:1.2
--- phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php:1.1
Wed May 6 20:45:42 2009
+++ phpruntests/src/configuration/preconditions/rtIsPhpVersionCorrect.php
Thu May 7 20:58:45 2009
@@ -51,19 +51,6 @@
*/
public function check(rtRuntestsConfiguration $config)
{
- return ($this->checkRunVersion() && $this->checkExecVersion($config));
- }
-
- /**
- * check that executing php-version matches the precondition
- *
- * @param rtRuntestsConfiguration $config
- *
- * @return boolean
- * @access private
- */
- private function checkExecVersion(rtRuntestsConfiguration $config)
- {
$exec = escapeshellcmd($config->getSetting('PhpExecutable').' -v');
$pipe = popen($exec, "r");
@@ -74,17 +61,6 @@
}
/**
- * check that running php-version matches the precondition
- *
- * @return boolean
- * @access private
- */
- private function checkRunVersion()
- {
- return $this->parseVersionString('PHP '.phpversion());
- }
-
- /**
* parses the version-string and checks the required minimun-version
*
* @param string $versionStr output of "php -v"
@@ -94,8 +70,8 @@
*/
public function parseVersionString($versionStr)
{
- $major = substr($versionStr, 4,1);
- $minor = substr($versionStr, 6,1);
+ $major = substr($versionStr, 4, 1);
+ $minor = substr($versionStr, 6, 1);
if ($major > $this->requiredMajorVersion) {
return true;
http://cvs.php.net/viewvc.cgi/phpruntests/src/run-tests.php?r1=1.1.1.1&r2=1.2&diff_format=u
Index: phpruntests/src/run-tests.php
diff -u phpruntests/src/run-tests.php:1.1.1.1 phpruntests/src/run-tests.php:1.2
--- phpruntests/src/run-tests.php:1.1.1.1 Wed Apr 15 16:30:18 2009
+++ phpruntests/src/run-tests.php Thu May 7 20:58:45 2009
@@ -2,12 +2,40 @@
/*
* Main php file for run-tests.php
*/
-require_once dirname(__FILE__) . '/rtAutoload.php';
+/*
+ * check the version of the running php-executable and
+ * ensure that is 5.3 or higher
+ */
+$v = phpversion();
-$phpTestRun = new rtPhpTestRun($argv);
-$phpTestRun->run();
+$major = substr($v, 0, 1);
+$minor = substr($v, 2, 1);
+$isVersionOk = false;
+
+if ($major > 5) {
+ $isVersionOk = true;
+
+} elseif ($major == 5) {
+
+ if ($minor >= 3) {
+ $isVersionOk = true;
+ }
+}
+
+
+if ($isVersionOk) {
+
+ require_once dirname(__FILE__) . '/rtAutoload.php';
+
+ $phpTestRun = new rtPhpTestRun($argv);
+ $phpTestRun->run();
+
+} else {
+
+ die("This version of run-tests requires PHP 5.3 or higher.\nYou can check
your current version by executing 'php -v' from the command line.\n");
+}
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php