Permalink
Browse files

Fixing unit tests and invalid argument problem

  • Loading branch information...
zoe slattery
zoe slattery committed May 21, 2012
1 parent ddc50ad commit 8ccb00b2bca6a04af566e45f386bd46edaa35962
View
@@ -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.">
View
@@ -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
@@ -168,5 +168,6 @@ public function getMemoryToolCommand() {
return $this->memoryTool->getCommand();
}
+
}
?>
@@ -103,9 +103,11 @@ public function run()
$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();
+ }
}
}
View
@@ -14,23 +14,11 @@
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")));
-}
-
?>
@@ -24,7 +24,8 @@ public function testFileRun()
{
//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
@@ -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()
@@ -25,7 +25,8 @@ public function testFileRun()
{
//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
@@ -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()
@@ -23,7 +23,8 @@ public function testFileRun()
{
//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
@@ -23,7 +23,8 @@ public function testFileRun()
{
//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

0 comments on commit 8ccb00b

Please sign in to comment.