Skip to content

Commit

Permalink
Fixing unit tests and invalid argument problem
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe slattery committed May 21, 2012
1 parent ddc50ad commit 8ccb00b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 35 deletions.
2 changes: 0 additions & 2 deletions build.xml
Expand Up @@ -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.">
Expand Down
14 changes: 9 additions & 5 deletions phpdefinitions.txt_sample
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/configuration/rtRuntestsConfiguration.php
Expand Up @@ -168,5 +168,6 @@ public function getMemoryToolCommand() {
return $this->memoryTool->getCommand();
}


}
?>
8 changes: 5 additions & 3 deletions src/testrun/rtPhpTestRun.php
Expand Up @@ -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();
}
}
}

Expand Down
22 changes: 5 additions & 17 deletions tests/rtTestBootstrap.php
Expand Up @@ -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")));
}

?>
3 changes: 2 additions & 1 deletion tests/testcase/rtCookieExecutionTest.php
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tests/testcase/rtDeflatePostExecutionTest.php
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tests/testcase/rtGetExecutionTest.php
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tests/testcase/rtGzipPostExecutionTest.php
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tests/testcase/rtPostExecutionTest.php
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/testcase/rtPostRawExecutionTest.php
Expand Up @@ -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
Expand Down

0 comments on commit 8ccb00b

Please sign in to comment.