Permalink
Browse files

Change the tests to use the TestBootstrap for PHP defs

  • Loading branch information...
1 parent b1ddef2 commit 6e7a69ab6338792fd5aa277eebf00a4c952d5027 Zoe Slattery committed May 10, 2012
@@ -12,6 +12,7 @@
*/
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
/**
* Tests for rtPreCondtionListTest precondition.
@@ -38,10 +39,9 @@ protected function tearDown()
public function testCheck()
{
- $php = trim(shell_exec("which php"));
$preConditionList = rtPreConditionList::getInstance();
- $runtestsConfiguration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $php, 'a-test.phpt'));
+ $runtestsConfiguration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'a-test.phpt'));
$runtestsConfiguration->configure();
$this->assertTrue($preConditionList->check($runtestsConfiguration));
@@ -1,33 +1,33 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtRuntestsConfigurationTest extends PHPUnit_Framework_TestCase
{
public function setUp() {
- $this->php = trim(shell_exec("which php"));
}
public function testCreateUnix()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'));
$config->configure();
$testFiles = $config->getSetting('TestFiles');
- $this->assertEquals($this->php, $config->getSetting('PhpExecutable'));
+ $this->assertEquals(RT_PHP_PATH, $config->getSetting('PhpExecutable'));
$this->assertEquals('test.phpt', $testFiles[0]);
}
public function testCreateWin()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'), 'Windows');
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'), 'Windows');
$config->configure();
$testFiles = $config->getSetting('TestFiles');
- $this->assertEquals($this->php, $config->getSetting('PhpExecutable'));
+ $this->assertEquals(RT_PHP_PATH, $config->getSetting('PhpExecutable'));
$this->assertEquals('test.phpt', $testFiles[0]);
}
}
@@ -1,6 +1,7 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtCleanExecutionTest extends PHPUnit_Framework_TestCase
{
@@ -10,8 +11,6 @@ class rtCleanExecutionTest extends PHPUnit_Framework_TestCase
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
-
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_clean.phpt';
$this->sample_fail = $this->path_to_tests . '/sample_clean_fail.phpt';
@@ -27,7 +26,7 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
$config->configure();
//Retrieve the array of test file names
@@ -55,7 +54,7 @@ public function testFileRun()
public function testFailedClean()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_fail));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_fail));
$config->configure();
//Retrieve the array of test file names
@@ -1,6 +1,7 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtCookieExecutionTest extends PHPUnit_Framework_TestCase
{
@@ -9,10 +10,7 @@ class rtCookieExecutionTest extends PHPUnit_Framework_TestCase
private $sample_fail;
public function setUp()
- {
- $this->php = trim(shell_exec("which php"));
- $this->php_cgi = trim(shell_exec("which php-cgi"));
-
+ {
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_cookie.phpt';
}
@@ -25,8 +23,8 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
- $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',RT_PHP_CGI_PATH);
$config->configure();
//Retrieve the array of test file names
@@ -1,16 +1,14 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtDeflatePostExecutionTest extends PHPUnit_Framework_TestCase
{
private $sample_test;
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
- $this->php_cgi = trim(shell_exec("which php-cgi"));
-
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt';
}
@@ -23,8 +21,8 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
- $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH);
$config->configure();
//Retrieve the array of test file names
@@ -1,6 +1,7 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtFileExternalExecutionTest extends PHPUnit_Framework_TestCase
{
@@ -10,8 +11,6 @@ class rtFileExternalExecutionTest extends PHPUnit_Framework_TestCase
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
-
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_fileexternal.phpt';
$this->sample_fail1 = $this->path_to_tests . '/sample_fileexternal1.phpt';
@@ -26,7 +25,7 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
$config->configure();
//Retrieve the array of test file names
@@ -52,7 +51,7 @@ public function testFileRun()
public function testFail1()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_fail1));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_fail1));
$config->configure();
//Retrieve the array of test file names
@@ -78,7 +77,7 @@ public function testFail1()
public function testFail2()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_fail2));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_fail2));
$config->configure();
//Retrieve the array of test file names
@@ -1,6 +1,7 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtGetExecutionTest extends PHPUnit_Framework_TestCase
{
@@ -10,8 +11,6 @@ class rtGetExecutionTest extends PHPUnit_Framework_TestCase
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
- $this->php_cgi = trim(shell_exec("which php-cgi"));
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_get.phpt';
@@ -25,8 +24,8 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
- $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH);
$config->configure();
//Retrieve the array of test file names
@@ -56,7 +55,7 @@ public function testFileRun()
public function testNoCGI()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
$config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', null);
$config->configure();
@@ -1,16 +1,14 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtGzipPostExecutionTest extends PHPUnit_Framework_TestCase
{
private $sample_test;
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
- $this->php_cgi = trim(shell_exec("which php-cgi"));
-
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_gzippost.phpt';
}
@@ -23,8 +21,8 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
- $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH);
$config->configure();
//Retrieve the array of test file names
@@ -1,13 +1,12 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtPhpRunnerTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
-
$fh = fopen('/tmp/test.php', 'w');
fwrite($fh, '<?php echo "hello world"; ?>');
fclose($fh);
@@ -25,14 +24,14 @@ public function tearDown()
public function testSimple()
{
- $PhpRunner = new rtPhpRunner($this->php . ' -n /tmp/test.php 2>&1', array(), '/tmp');
+ $PhpRunner = new rtPhpRunner(RT_PHP_PATH . ' -n /tmp/test.php 2>&1', array(), '/tmp');
$this->assertEquals("hello world", $PhpRunner->runphp());
}
public function testStdin()
{
- $PhpRunner = new rtPhpRunner($this->php .' -n /tmp/test2.php 2>&1', array(), '/tmp', 'hello');
+ $PhpRunner = new rtPhpRunner(RT_PHP_PATH .' -n /tmp/test2.php 2>&1', array(), '/tmp', 'hello');
$this->assertEquals("hello", $PhpRunner->runphp());
}
@@ -1,12 +1,12 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtPhpTestTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
$this->testCase = array (
'--TEST--',
'This is a test',
@@ -43,7 +43,7 @@ public function setUp()
public function testCreateInstance()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'));
$config->configure();
$status = new rtTestStatus('nameOfTest');
@@ -54,7 +54,7 @@ public function testCreateInstance()
public function testSections()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'));
$config->configure();
$status = new rtTestStatus('nameOfTest');
@@ -67,7 +67,7 @@ public function testSections()
public function testDone()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'));
$config->configure();
$status = new rtTestStatus('nameOfTest');
@@ -83,7 +83,7 @@ public function testDone()
public function testEmptySection()
{
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, 'test.phpt'));
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, 'test.phpt'));
$config->configure();
$status = new rtTestStatus('nameOfTest');
@@ -1,15 +1,14 @@
<?php
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+require_once dirname(__FILE__) . '/../rtTestBootstrap.php';
class rtPostExecutionTest extends PHPUnit_Framework_TestCase
{
private $sample_test;
public function setUp()
{
- $this->php = trim(shell_exec("which php"));
- $this->php_cgi = trim(shell_exec("which php-cgi"));
$this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
$this->sample_test = $this->path_to_tests . '/sample_post.phpt';
@@ -23,8 +22,8 @@ public function tearDown()
public function testFileRun()
{
//Create a new test configuration
- $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test));
- $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', RT_PHP_CGI_PATH);
$config->configure();
//Retrieve the array of test file names
Oops, something went wrong.

0 comments on commit 6e7a69a

Please sign in to comment.