Permalink
Browse files

change to use a single configuration file for testing

  • Loading branch information...
1 parent 6e7a69a commit 571e6cb00c85a618df98b9ab1333a1ece0b39bd5 Zoe Slattery committed May 10, 2012
Showing with 35 additions and 6 deletions.
  1. +5 −3 build.xml
  2. +9 −0 phpdefinitions.txt
  3. +19 −2 tests/rtTestBootstrap.php
  4. +2 −1 tests/testcase/rtCleanExecutionTest.php
View
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project name="runtests" default="qa" basedir=".">
+<property file="phpdefinitions.txt" />
<target name="clean">
<delete dir="_compare" />
@@ -51,7 +52,8 @@
<target name="compare" description="Old/New comparison of phpt results.">
<fail unless="php" message="Path to standard PHP executable not defined, use -Dphp=/path/to/php" />
- <fail unless="php_to_test" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php_source_dir" />
+ <fail unless="php_to_test" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php/to/test" />
+ <fail unless="php_source" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php_source_dir" />
<delete dir="_compare" />
@@ -64,8 +66,8 @@
<exec command="tar xfz QATESTS.tgz" dir="/tmp/phpruntests" />
- <exec command="${php} -n ${php_to_test}/run-tests.php -n -p ${php_to_test}/sapi/cli/php /tmp/phpruntests/Zend /tmp/phpruntests/ext /tmp/phpruntests/sapi /tmp/phpruntests/tests > ${project.basedir}/_compare/old.out" dir="/tmp/phpruntests" passthru="true" checkReturn="true"/>
- <exec command="${php} -n ${project.basedir}/src/run-tests.php -n -p ${php_to_test}/sapi/cli/php -o csv -s ${project.basedir}/_compare/new.out /tmp/phpruntests" dir="/tmp/phpruntests" passthru="true" checkReturn="true" />
+ <exec command="${php} -n ${php_source}/run-tests.php -n -p ${php_to_test} /tmp/phpruntests/Zend /tmp/phpruntests/ext /tmp/phpruntests/sapi /tmp/phpruntests/tests > ${project.basedir}/_compare/old.out" dir="/tmp/phpruntests" passthru="true" checkReturn="true"/>
+ <exec command="${php} -n ${project.basedir}/src/run-tests.php -n -p ${php_to_test} -o csv -s ${project.basedir}/_compare/new.out /tmp/phpruntests" dir="/tmp/phpruntests" passthru="true" checkReturn="true" />
<exec command="${php} -n QA/compareNewOld.php ${project.basedir}/_compare/new.out ${project.basedir}/_compare/old.out phpruntests > ${project.basedir}/_compare/compare_new_old.out" dir="${project.basedir}" passthru="true" checkReturn="true"/>
View
@@ -0,0 +1,9 @@
+# This file is used as a phing property file and is also read by rtTestBoootstrap.php to determine which
+# PHP exectables to use in running unit tests
+
+#These are example settings, you will need to unomment and change them to the right paths on your system
+#
+#php=/usr/bin/php
+#php_to_test=/usr/local/php540/bin/php
+#php_cgi_to_test=/usr/local/php540/bin/php-cgi
+#php_source=/Users/zoe/Applications/PHP/php-5.4.0
View
@@ -3,14 +3,31 @@
require_once __DIR__ . '/../src/rtAutoload.php';
/**
- * Define the Path to the PHP executable
+ * Check to see if the PHP and CGI executables are in a config file
*/
+if(file_exists(__DIR__ . '/../phpdefinitions.txt')) {
+ $phpdefs=file(__DIR__ . '/../phpdefinitions.txt');
+ foreach($phpdefs as $line) {
+ if(preg_match('/^php_to_test=(.*)/', $line, $matches)) {
+ define('RT_PHP_PATH', trim($matches[1]));
+ }
+ if(preg_match('/^php_cgi_to_test=(.*)/', $line, $matches)) {
+ define('RT_PHP_CGI_PATH', trim($matches[1]));
+ }
+ }
+}
+
+
+/**
+ * Fall back definition of Path to the PHPexecutable
+ */
+
if (!defined('RT_PHP_PATH')) {
define('RT_PHP_PATH', trim(shell_exec("which php")));
}
/**
- * Define the Path to the PHP CGI executable
+ * Fall back definition of Path to the PHP CGI executable
*/
if (!defined('RT_PHP_CGI_PATH')) {
define('RT_PHP_CGI_PATH', trim(shell_exec("which php-cgi")));
@@ -8,6 +8,7 @@ class rtCleanExecutionTest extends PHPUnit_Framework_TestCase
private $path_to_tests;
private $sample_test;
private $sample_fail;
+
public function setUp()
{
@@ -25,7 +26,7 @@ public function tearDown()
public function testFileRun()
{
- //Create a new test configuration
+ //Create a new test configuration
$config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
$config->configure();

0 comments on commit 571e6cb

Please sign in to comment.