com phpruntests: Fixing unit tests and invalid argument problem: build.xml phpdefinitions.txt_sample src/configuration/rtRuntestsCon figuration.php
src/testrun/rtPhpTestRun.php tests/rtTes tBootstrap.php tests/testcase/rtCookieExecutionTest.php tests/testcase/rtDeflatePostExecutionTest.php
tests/test case/rtGetExecutionTest.php tests/testcase/rtGzipPostExecut ionTest.php tests/testcase/rtPostExecutionTest.php test
s/testcase/rtPostRawExecutionTest.php
| From: | Zoe Slattery | Date: | Mon, 21 May 2012 19:56:03 +0000 |
| Subject: | com phpruntests: Fixing unit tests and invalid argument problem: build.xml phpdefinitions.txt_sample src/configuration/rtRuntestsCon figuration.php src/testrun/rtPhpTestRun.php tests/rtTes tBootstrap.php tests/testcase/rtCookieExecutionTest.php tests/testcase/rtDeflatePostExecutionTest.php tests/test case/rtGetExecutionTest.php tests/testcase/rtGzipPostExecut ionTest.php tests/testcase/rtPostExecutionTest.php test s/testcase/rtPostRawExecutionTest.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66595@lists.php.net to get a copy of this message | ||
Commit: 8ccb00b2bca6a04af566e45f386bd46edaa35962
Author: zoe slattery <zoe@php.net> Mon, 21 May 2012 20:56:03 +0100
Parents: ddc50ad101f32115833a7c01ced8001bc12807c2
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=8ccb00b2bca6a04af566e45f386bd46edaa35962
Log:
Fixing unit tests and invalid argument problem
Changed paths:
M build.xml
M phpdefinitions.txt_sample
M src/configuration/rtRuntestsConfiguration.php
M src/testrun/rtPhpTestRun.php
M tests/rtTestBootstrap.php
M tests/testcase/rtCookieExecutionTest.php
M tests/testcase/rtDeflatePostExecutionTest.php
M tests/testcase/rtGetExecutionTest.php
M tests/testcase/rtGzipPostExecutionTest.php
M tests/testcase/rtPostExecutionTest.php
M tests/testcase/rtPostRawExecutionTest.php
diff --git a/build.xml b/build.xml index 4c7630b..c17a71d 100755 --- a/build.xml +++ b/build.xml @@ -82,9 +82,7 @@ <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"/> - <echo msg="Comparing the results from new runs with baseline Linux results" /> - <exec command="${php} -n QA/compareNewNew.php ${project.basedir}/QA/BaselineLinuxResults ${project.basedir}/_compare/new.out phpruntests > ${project.basedir}/_compare/compare_baseline_old.out" dir="${project.basedir}" passthru="true" checkReturn="true"/> </target> <target name="sniff" description="Run all PHP_CodeSniffer sniffs."> diff --git a/phpdefinitions.txt_sample b/phpdefinitions.txt_sample index 098f066..3363812 100644 --- a/phpdefinitions.txt_sample +++ b/phpdefinitions.txt_sample @@ -4,17 +4,21 @@ #These are example settings, you will change them to the right paths on your system #then copy this to phpdefinitions.txt # -#Your system defualt PHP -php=/usr/bin/php +#The version of PHP that you are using to run unit tests +php=/usr/local/php540naked/bin/php # #The version of PHP that you intend to test -php_to_test=/usr/local/php540/bin/php +php_to_test=/usr/local/php5xx/bin/php # #The version of PHP CGI that you intend to test -php_cgi_to_test=/usr/local/php540/bin/php-cgi +php_cgi_to_test=/usr/local/php5xx/bin/php-cgi +# +#If the versions of PHP that you intent to test have NOT been +#built --with-zlib, put zlib=0 on the next line. +zlib=1 # #The location of a copy run-tests.php for running comparison results (qa target) -php_source=/Users/zoe/Applications/PHP/php-5.4.0 +php_source=/Users/zoe/Workspaces/php-src # #Temporary (writable) directory - also used buy qa target temp_directory=/tmp diff --git a/src/configuration/rtRuntestsConfiguration.php b/src/configuration/rtRuntestsConfiguration.php index 744e9da..7db80ad 100644 --- a/src/configuration/rtRuntestsConfiguration.php +++ b/src/configuration/rtRuntestsConfiguration.php @@ -168,5 +168,6 @@ abstract class rtRuntestsConfiguration return $this->memoryTool->getCommand(); } + } ?> diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index 4e24632..f780df5 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -103,9 +103,11 @@ class rtPhpTestRun $redirects = $scheduler->getRedirectedTestCases(); - for($i=0; $i<sizeof($subDirectories); $i++) { - foreach($redirects[$i] as $redirectedTestCase) { - echo "\nTest not executed, requires redirect. : ".$redirectedTestCase->getName(); + if($redirects != null) { + for($i=0; $i<sizeof($subDirectories); $i++) { + foreach($redirects[$i] as $redirectedTestCase) { + echo "\nTest not executed, requires redirect. : ".$redirectedTestCase->getName(); + } } } diff --git a/tests/rtTestBootstrap.php b/tests/rtTestBootstrap.php index bbfe412..2e2d90f 100644 --- a/tests/rtTestBootstrap.php +++ b/tests/rtTestBootstrap.php @@ -14,23 +14,11 @@ if(file_exists(__DIR__ . '/../phpdefinitions.txt')) { if(preg_match('/^php_cgi_to_test=(.*)/', $line, $matches)) { define('RT_PHP_CGI_PATH', trim($matches[1])); } + if(preg_match('/^zlib=(.*)/', $line, $matches)) { + define('ZLIB', trim($matches[1])); + } } +} else { + echo "You must provide PHP versions in phpdefinitions.txt\n"; } - - -/** - * Fall back definition of Path to the PHPexecutable - */ - -if (!defined('RT_PHP_PATH')) { - define('RT_PHP_PATH', trim(shell_exec("which php"))); -} - -/** - * 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"))); -} - ?> diff --git a/tests/testcase/rtCookieExecutionTest.php b/tests/testcase/rtCookieExecutionTest.php index 67591ac..e759fd2 100644 --- a/tests/testcase/rtCookieExecutionTest.php +++ b/tests/testcase/rtCookieExecutionTest.php @@ -24,7 +24,8 @@ class rtCookieExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',RT_PHP_CGI_PATH." -n xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtDeflatePostExecutionTest.php b/tests/testcase/rtDeflatePostExecutionTest.php index 6ede533..33e9b7c 100644 --- a/tests/testcase/rtDeflatePostExecutionTest.php +++ b/tests/testcase/rtDeflatePostExecutionTest.php @@ -9,8 +9,14 @@ class rtDeflatePostExecutionTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt'; + if(ZLIB == 0) { + $this->markTestSkipped( + 'The zlib extension is not available.' + ); + } else { + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt'; + } } public function tearDown() diff --git a/tests/testcase/rtGetExecutionTest.php b/tests/testcase/rtGetExecutionTest.php index 0b24ed7..a666c65 100644 --- a/tests/testcase/rtGetExecutionTest.php +++ b/tests/testcase/rtGetExecutionTest.php @@ -25,7 +25,8 @@ class rtGetExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtGzipPostExecutionTest.php b/tests/testcase/rtGzipPostExecutionTest.php index f1abc2c..5aa4c53 100644 --- a/tests/testcase/rtGzipPostExecutionTest.php +++ b/tests/testcase/rtGzipPostExecutionTest.php @@ -9,8 +9,14 @@ class rtGzipPostExecutionTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $this->path_to_tests . '/sample_gzippost.phpt'; + if(ZLIB == 0) { + $this->markTestSkipped( + 'The zlib extension is not available.' + ); + } else { + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_gzippost.phpt'; + } } public function tearDown() diff --git a/tests/testcase/rtPostExecutionTest.php b/tests/testcase/rtPostExecutionTest.php index e77b18a..23f537f 100644 --- a/tests/testcase/rtPostExecutionTest.php +++ b/tests/testcase/rtPostExecutionTest.php @@ -23,7 +23,8 @@ class rtPostExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtPostRawExecutionTest.php b/tests/testcase/rtPostRawExecutionTest.php index 0cebd90..8aad725 100644 --- a/tests/testcase/rtPostRawExecutionTest.php +++ b/tests/testcase/rtPostRawExecutionTest.php @@ -23,7 +23,8 @@ class rtPostRawExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names
diff --git a/build.xml b/build.xml index 4c7630b..c17a71d 100755 --- a/build.xml +++ b/build.xml @@ -82,9 +82,7 @@ <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"/> - <echo msg="Comparing the results from new runs with baseline Linux results" /> - <exec command="${php} -n QA/compareNewNew.php ${project.basedir}/QA/BaselineLinuxResults ${project.basedir}/_compare/new.out phpruntests > ${project.basedir}/_compare/compare_baseline_old.out" dir="${project.basedir}" passthru="true" checkReturn="true"/> </target> <target name="sniff" description="Run all PHP_CodeSniffer sniffs."> diff --git a/phpdefinitions.txt_sample b/phpdefinitions.txt_sample index 098f066..3363812 100644 --- a/phpdefinitions.txt_sample +++ b/phpdefinitions.txt_sample @@ -4,17 +4,21 @@ #These are example settings, you will change them to the right paths on your system #then copy this to phpdefinitions.txt # -#Your system defualt PHP -php=/usr/bin/php +#The version of PHP that you are using to run unit tests +php=/usr/local/php540naked/bin/php # #The version of PHP that you intend to test -php_to_test=/usr/local/php540/bin/php +php_to_test=/usr/local/php5xx/bin/php # #The version of PHP CGI that you intend to test -php_cgi_to_test=/usr/local/php540/bin/php-cgi +php_cgi_to_test=/usr/local/php5xx/bin/php-cgi +# +#If the versions of PHP that you intent to test have NOT been +#built --with-zlib, put zlib=0 on the next line. +zlib=1 # #The location of a copy run-tests.php for running comparison results (qa target) -php_source=/Users/zoe/Applications/PHP/php-5.4.0 +php_source=/Users/zoe/Workspaces/php-src # #Temporary (writable) directory - also used buy qa target temp_directory=/tmp diff --git a/src/configuration/rtRuntestsConfiguration.php b/src/configuration/rtRuntestsConfiguration.php index 744e9da..7db80ad 100644 --- a/src/configuration/rtRuntestsConfiguration.php +++ b/src/configuration/rtRuntestsConfiguration.php @@ -168,5 +168,6 @@ abstract class rtRuntestsConfiguration return $this->memoryTool->getCommand(); } + } ?> diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index 4e24632..f780df5 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -103,9 +103,11 @@ class rtPhpTestRun $redirects = $scheduler->getRedirectedTestCases(); - for($i=0; $i<sizeof($subDirectories); $i++) { - foreach($redirects[$i] as $redirectedTestCase) { - echo "\nTest not executed, requires redirect. : ".$redirectedTestCase->getName(); + if($redirects != null) { + for($i=0; $i<sizeof($subDirectories); $i++) { + foreach($redirects[$i] as $redirectedTestCase) { + echo "\nTest not executed, requires redirect. : ".$redirectedTestCase->getName(); + } } } diff --git a/tests/rtTestBootstrap.php b/tests/rtTestBootstrap.php index bbfe412..2e2d90f 100644 --- a/tests/rtTestBootstrap.php +++ b/tests/rtTestBootstrap.php @@ -14,23 +14,11 @@ if(file_exists(__DIR__ . '/../phpdefinitions.txt')) { if(preg_match('/^php_cgi_to_test=(.*)/', $line, $matches)) { define('RT_PHP_CGI_PATH', trim($matches[1])); } + if(preg_match('/^zlib=(.*)/', $line, $matches)) { + define('ZLIB', trim($matches[1])); + } } +} else { + echo "You must provide PHP versions in phpdefinitions.txt\n"; } - - -/** - * Fall back definition of Path to the PHPexecutable - */ - -if (!defined('RT_PHP_PATH')) { - define('RT_PHP_PATH', trim(shell_exec("which php"))); -} - -/** - * 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"))); -} - ?> diff --git a/tests/testcase/rtCookieExecutionTest.php b/tests/testcase/rtCookieExecutionTest.php index 67591ac..e759fd2 100644 --- a/tests/testcase/rtCookieExecutionTest.php +++ b/tests/testcase/rtCookieExecutionTest.php @@ -24,7 +24,8 @@ class rtCookieExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',RT_PHP_CGI_PATH." -n xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtDeflatePostExecutionTest.php b/tests/testcase/rtDeflatePostExecutionTest.php index 6ede533..33e9b7c 100644 --- a/tests/testcase/rtDeflatePostExecutionTest.php +++ b/tests/testcase/rtDeflatePostExecutionTest.php @@ -9,8 +9,14 @@ class rtDeflatePostExecutionTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt'; + if(ZLIB == 0) { + $this->markTestSkipped( + 'The zlib extension is not available.' + ); + } else { + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt'; + } } public function tearDown() diff --git a/tests/testcase/rtGetExecutionTest.php b/tests/testcase/rtGetExecutionTest.php index 0b24ed7..a666c65 100644 --- a/tests/testcase/rtGetExecutionTest.php +++ b/tests/testcase/rtGetExecutionTest.php @@ -25,7 +25,8 @@ class rtGetExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtGzipPostExecutionTest.php b/tests/testcase/rtGzipPostExecutionTest.php index f1abc2c..5aa4c53 100644 --- a/tests/testcase/rtGzipPostExecutionTest.php +++ b/tests/testcase/rtGzipPostExecutionTest.php @@ -9,8 +9,14 @@ class rtGzipPostExecutionTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $this->path_to_tests . '/sample_gzippost.phpt'; + if(ZLIB == 0) { + $this->markTestSkipped( + 'The zlib extension is not available.' + ); + } else { + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_gzippost.phpt'; + } } public function tearDown() diff --git a/tests/testcase/rtPostExecutionTest.php b/tests/testcase/rtPostExecutionTest.php index e77b18a..23f537f 100644 --- a/tests/testcase/rtPostExecutionTest.php +++ b/tests/testcase/rtPostExecutionTest.php @@ -23,7 +23,8 @@ class rtPostExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names diff --git a/tests/testcase/rtPostRawExecutionTest.php b/tests/testcase/rtPostRawExecutionTest.php index 0cebd90..8aad725 100644 --- a/tests/testcase/rtPostRawExecutionTest.php +++ b/tests/testcase/rtPostRawExecutionTest.php @@ -23,7 +23,8 @@ class rtPostRawExecutionTest extends PHPUnit_Framework_TestCase { //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); - $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH); + //Need to get rid of xdebug in these tests, reformats the output so they fail. + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH." -d xdebug.default_enable=0"); $config->configure(); //Retrieve the array of test file names