cvs: phpruntests /tests/testcase rtCleanExecutionTest.php rtPhpRunnerTest.php rtPhpTestFileTest.php rtPhpTestTest.php rtSkipIfExecutionTest.php
rtTestConfigurationTest.php rtTestDifferenceTest.php rtTestExecutionTest.php rtTestOutputWriterTest.php rtTestResultsTest.php

From: Date: Wed, 22 Apr 2009 09:14:51 +0000
Subject: cvs: phpruntests /tests/testcase rtCleanExecutionTest.php rtPhpRunnerTest.php rtPhpTestFileTest.php rtPhpTestTest.php rtSkipIfExecutionTest.php
rtTestConfigurationTest.php rtTestDifferenceTest.php rtTestExecutionTest.php rtTestOutputWriterTest.php rtTestResultsTest.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-57128@lists.php.net to get a copy of this message
spriebsch Wed Apr 22 09:14:51 2009 UTC Modified files: /phpruntests/tests/testcase rtCleanExecutionTest.php rtPhpRunnerTest.php rtPhpTestFileTest.php rtPhpTestTest.php rtSkipIfExecutionTest.php rtTestConfigurationTest.php rtTestDifferenceTest.php rtTestExecutionTest.php rtTestOutputWriterTest.php rtTestResultsTest.php Log: Reformatted to conform to PEAR coding standard.

http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtCleanExecutionTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtCleanExecutionTest.php diff -u phpruntests/tests/testcase/rtCleanExecutionTest.php:1.1.1.1 phpruntests/tests/testcase/rtCleanExecutionTest.php:1.2 --- phpruntests/tests/testcase/rtCleanExecutionTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtCleanExecutionTest.php Wed Apr 22 09:14:51 2009 @@ -1,79 +1,81 @@ <?php require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - - class rtCleanExecutionTest extends PHPUnit_Framework_TestCase - { +class rtCleanExecutionTest extends PHPUnit_Framework_TestCase +{ private $path_to_tests; private $sample_test; private $sample_fail; - - 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'; - - + + 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'; } - - public function tearDown() { - @unlink($this->path-to_tests. '/sample_clean.clean.php'); - @unlink($this->path-to_tests. '/phpt-tests/sample_clean_fail.clean.php'); - @unlink($this->path-to_tests. '/cleantest.tmp'); + + public function tearDown() + { + @unlink($this->path-to_tests . '/sample_clean.clean.php'); + @unlink($this->path-to_tests . '/phpt-tests/sample_clean_fail.clean.php'); + @unlink($this->path-to_tests . '/cleantest.tmp'); } - - public function testFileRun() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //Check that the temp file has been removed - $fileName = $this->path_to_tests. '/phpt-tests/cleantest.tmp'; - $this->assertFalse(file_exists($fileName)); + + public function testFileRun() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile = new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //Check that the temp file has been removed + $fileName = $this->path_to_tests . '/phpt-tests/cleantest.tmp'; + + $this->assertFalse(file_exists($fileName)); } - - public function testFailedClean() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_fail)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //Check that the temp file has been removed - $fileName = $this->path_to_tests. '/cleantest.tmp'; - $this->assertTrue(file_exists($fileName)); + + public function testFailedClean() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_fail)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile = new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //Check that the temp file has been removed + $fileName = $this->path_to_tests . '/cleantest.tmp'; + + $this->assertTrue(file_exists($fileName)); } - } +} -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtPhpRunnerTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtPhpRunnerTest.php diff -u phpruntests/tests/testcase/rtPhpRunnerTest.php:1.1.1.1 phpruntests/tests/testcase/rtPhpRunnerTest.php:1.2 --- phpruntests/tests/testcase/rtPhpRunnerTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtPhpRunnerTest.php Wed Apr 22 09:14:51 2009 @@ -1,45 +1,42 @@ <?php - require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.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); - - $fh = fopen('/tmp/test2.php', 'w'); - fwrite($fh, '<?php echo stream_get_contents(STDIN); ?>'); - fclose($fh); - - } - - public function tearDown() { - unlink('/tmp/test.php'); - unlink('/tmp/test2.php'); - } - - public function testSimple() { - $PhpRunner = new rtPhpRunner($this->php.' -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'); - - $this->assertEquals("hello", $PhpRunner->runphp()); - - } +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); + + $fh = fopen('/tmp/test2.php', 'w'); + fwrite($fh, '<?php echo stream_get_contents(STDIN); ?>'); + fclose($fh); + } + + public function tearDown() + { + unlink('/tmp/test.php'); + unlink('/tmp/test2.php'); + } + + public function testSimple() + { + $PhpRunner = new rtPhpRunner($this->php . ' -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'); + + $this->assertEquals("hello", $PhpRunner->runphp()); + } } -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtPhpTestFileTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtPhpTestFileTest.php diff -u phpruntests/tests/testcase/rtPhpTestFileTest.php:1.1.1.1 phpruntests/tests/testcase/rtPhpTestFileTest.php:1.2 --- phpruntests/tests/testcase/rtPhpTestFileTest.php:1.1.1.1 Wed Apr 15 16:30:21 2009 +++ phpruntests/tests/testcase/rtPhpTestFileTest.php Wed Apr 22 09:14:51 2009 @@ -1,75 +1,77 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtPhpTestFileTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_test.phpt'; + $this->sample_extra_char = $this->path_to_tests. '/sample_extra_char.phpt'; + $this->sample_windows_test = $this->path_to_tests . '/sample_windows_test.phpt'; + } + + public function testCreateInstance() + { + $testFile = new rtPhpTestFile(); - class rtPhpTestFileTest extends PHPUnit_Framework_TestCase { - - public function setUp() { - $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $this->path_to_tests . '/sample_test.phpt'; - $this->sample_extra_char = $this->path_to_tests. '/sample_extra_char.phpt'; - $this->sample_windows_test = $this->path_to_tests . '/sample_windows_test.phpt'; + $this->assertTrue(is_object($testFile)); } - - - public function testCreateInstance() { - $testFile = new rtPhpTestFile(); - $this->assertTrue(is_object($testFile)); - } - - - public function testReadGoodFile() { - $testFile = new rtPhpTestFile(); - $testFile->doRead($this->sample_test); - $testFile->normaliseLineEndings(); - $fileArray = $testFile->getContents(); - $this->assertEquals('TEST', $fileArray[0]); - - $this->assertEquals($this->path_to_tests."/sample_test", $testFile->getTestName()); - } + public function testReadGoodFile() + { + $testFile = new rtPhpTestFile(); + $testFile->doRead($this->sample_test); + $testFile->normaliseLineEndings(); + $fileArray = $testFile->getContents(); + $this->assertEquals('TEST', $fileArray[0]); + + $this->assertEquals($this->path_to_tests."/sample_test", $testFile->getTestName()); + } - public function testWindowsLineEndings() { - $testFile = new rtPhpTestFile(); - $testFile->doRead($this->sample_windows_test); - $testFile->normaliseLineEndings(); - $fileArray = $testFile->getContents(); - $fileString = implode(' ', $fileArray); - - $unmodified = file_get_contents($this->sample_windows_test); - - //Check that there are windows line endings in the original - $this->assertEquals(preg_match('/\r\n/', $unmodified), 1); - - //..and that they have been successfully removed - $this->assertEquals(preg_match("/\r\n/", $fileString), 0); + public function testWindowsLineEndings() + { + $testFile = new rtPhpTestFile(); + $testFile->doRead($this->sample_windows_test); + $testFile->normaliseLineEndings(); + $fileArray = $testFile->getContents(); + $fileString = implode(' ', $fileArray); + + $unmodified = file_get_contents($this->sample_windows_test); + + //Check that there are windows line endings in the original + $this->assertEquals(preg_match('/\r\n/', $unmodified), 1); + + //..and that they have been successfully removed + $this->assertEquals(preg_match("/\r\n/", $fileString), 0); } - public function testLinuxLineEndings() { - $testFile = new rtPhpTestFile(); - $testFile->doRead($this->sample_test); - $testFile->normaliseLineEndings(); - $fileArray = $testFile->getContents(); - $fileString = implode(' ', $fileArray); - - $unmodified = file_get_contents($this->sample_test); - - //Check that there are windows line endings in the original - $this->assertEquals(preg_match('/\n/', $unmodified), 1); - - //..and that they have been successfully removed - $this->assertEquals(preg_match("/\n/", $fileString), 0); + public function testLinuxLineEndings() + { + $testFile = new rtPhpTestFile(); + $testFile->doRead($this->sample_test); + $testFile->normaliseLineEndings(); + $fileArray = $testFile->getContents(); + $fileString = implode(' ', $fileArray); + + $unmodified = file_get_contents($this->sample_test); + + //Check that there are windows line endings in the original + $this->assertEquals(preg_match('/\n/', $unmodified), 1); + + //..and that they have been successfully removed + $this->assertEquals(preg_match("/\n/", $fileString), 0); } - public function testPreconditionCall() { - $testFile = new rtPhpTestFile(); - $testFile->doRead($this->sample_test); - $testFile->normaliseLineEndings(); - $this->assertTrue($testFile->arePreConditionsMet()); - + public function testPreconditionCall() + { + $testFile = new rtPhpTestFile(); + $testFile->doRead($this->sample_test); + $testFile->normaliseLineEndings(); + + $this->assertTrue($testFile->arePreConditionsMet()); } - - } -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtPhpTestTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtPhpTestTest.php diff -u phpruntests/tests/testcase/rtPhpTestTest.php:1.1.1.1 phpruntests/tests/testcase/rtPhpTestTest.php:1.2 --- phpruntests/tests/testcase/rtPhpTestTest.php:1.1.1.1 Wed Apr 15 16:30:21 2009 +++ phpruntests/tests/testcase/rtPhpTestTest.php Wed Apr 22 09:14:51 2009 @@ -1,41 +1,44 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; -class rtPhpTestTest extends PHPUnit_Framework_TestCase { +class rtPhpTestTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $this->testCase = array ( + 'TEST', + 'This is a test', + 'FILE', + '<?php', + ' echo "hello world"; ', + '?>', + 'EXPECTF', + 'hello world', + ); + } + + public function testCreateInstance() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); + + $test = new rtPhpTest($this->testCase, 'nameOfTest', array('TEST', 'FILE', 'EXPECTF'), $config); + + $this->assertEquals('rtPhpTest', get_class($test)); + } + + public function testSections() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); + + $test = new rtPhpTest($this->testCase, 'nameOfTest', array('TEST', 'FILE', 'EXPECTF'), $config); - public function setUp() { - $this->testCase = array ( - 'TEST', - 'This is a test', - 'FILE', - '<?php', - ' echo "hello world"; ', - '?>', - 'EXPECTF', - 'hello world', - ); - } - - public function testCreateInstance() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); - - $test = new rtPhpTest($this->testCase, 'nameOfTest', array('TEST', 'FILE', 'EXPECTF'), $config); - $this->assertEquals('rtPhpTest', get_class($test)); - - } - - public function testSections() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); - - $test = new rtPhpTest($this->testCase, 'nameOfTest', array('TEST', 'FILE', 'EXPECTF'), $config); - $this->assertEquals('rtTestHeaderSection', get_class($test->getSection('TEST'))); - $this->assertEquals('rtFileSection', get_class($test->getSection('FILE'))); - $this->assertEquals('rtExpectFSection', get_class($test->getSection('EXPECTF'))); - } - - + $this->assertEquals('rtTestHeaderSection', get_class($test->getSection('TEST'))); + $this->assertEquals('rtFileSection', get_class($test->getSection('FILE'))); + $this->assertEquals('rtExpectFSection', get_class($test->getSection('EXPECTF'))); + } } -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtSkipIfExecutionTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtSkipIfExecutionTest.php diff -u phpruntests/tests/testcase/rtSkipIfExecutionTest.php:1.1.1.1 phpruntests/tests/testcase/rtSkipIfExecutionTest.php:1.2 --- phpruntests/tests/testcase/rtSkipIfExecutionTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtSkipIfExecutionTest.php Wed Apr 22 09:14:51 2009 @@ -1,45 +1,46 @@ <?php require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - - class rtSkipIfExecutionTest extends PHPUnit_Framework_TestCase - { +class rtSkipIfExecutionTest extends PHPUnit_Framework_TestCase +{ private $path_to_tests; - - public function setUp() { - $this->php = trim(shell_exec("which php")); - $path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); - $this->sample_test = $path_to_tests . '/sample_skipif.phpt'; + + public function setUp() + { + $this->php = trim(shell_exec("which php")); + $path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $path_to_tests . '/sample_skipif.phpt'; } - - public function tearDown() { - @unlink($this->path_to_tests. '/sample_skipif.skipif.php'); + + public function tearDown() + { + @unlink($this->path_to_tests. '/sample_skipif.skipif.php'); } - - public function testFileRun() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //Check that the test has been skipped - $this->assertTrue(array_key_exists('skip', $testCase->getStatus())); + + public function testFileRun() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //Check that the test has been skipped + $this->assertTrue(array_key_exists('skip', $testCase->getStatus())); } - } - -?> \ No newline at end of file +} +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtTestConfigurationTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtTestConfigurationTest.php diff -u phpruntests/tests/testcase/rtTestConfigurationTest.php:1.1.1.1 phpruntests/tests/testcase/rtTestConfigurationTest.php:1.2 --- phpruntests/tests/testcase/rtTestConfigurationTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtTestConfigurationTest.php Wed Apr 22 09:14:51 2009 @@ -1,54 +1,63 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; -class rtTestConfigurationTest extends PHPUnit_Framework_TestCase { +class rtTestConfigurationTest extends PHPUnit_Framework_TestCase +{ + private $sections; + + public function setUp() + { + $this->sections['ARGS'] = new rtArgsSection('ARGS',array('-vvv -a value -1111 -2 -v')); + $this->sections['ENV'] = new rtEnvSection('ENV',array('env1 = ENV1', 'env2=ENV2')); + $this->sections['INI'] = new rtIniSection('INI',array('error_reporting=E_ALL | E_STRICT | E_DEPRECATED', 'assert.active = 1')); + } + + public function testCreateInstance() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); - private $sections; + $testConfiguration = new rtTestConfiguration($config, $this->sections); - public function setUp() { - $this->sections['ARGS'] = new rtArgsSection('ARGS',array('-vvv -a value -1111 -2 -v')); - $this->sections['ENV'] = new rtEnvSection('ENV',array('env1 = ENV1', 'env2=ENV2')); - $this->sections['INI'] = new rtIniSection('INI',array('error_reporting=E_ALL | E_STRICT | E_DEPRECATED', 'assert.active = 1')); - } + $this->assertEquals('rtTestConfiguration', get_class($testConfiguration)); + } - public function testCreateInstance() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); + public function testEnv() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); - $testConfiguration = new rtTestConfiguration($config, $this->sections); + $testConfiguration = new rtTestConfiguration($config, $this->sections); - $this->assertEquals('rtTestConfiguration', get_class($testConfiguration)); - } + $envVars = $testConfiguration->getEnvironmentVariables(); - public function testEnv() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); + $this->assertEquals('ENV1', $envVars['env1']); + } - $testConfiguration = new rtTestConfiguration($config, $this->sections); + public function testArgs() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); - $envVars = $testConfiguration->getEnvironmentVariables(); - $this->assertEquals('ENV1', $envVars['env1']); - } + $testConfiguration = new rtTestConfiguration($config, $this->sections); - public function testArgs() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); + $args = $testConfiguration->getTestCommandLineArguments(); - $testConfiguration = new rtTestConfiguration($config, $this->sections); + $this->assertEquals('-- -vvv -a value -1111 -2 -v', $args); + } - $args = $testConfiguration->getTestCommandLineArguments(); - $this->assertEquals('-- -vvv -a value -1111 -2 -v', $args); - } + public function testIni() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); - public function testIni() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); + $testConfiguration = new rtTestConfiguration($config, $this->sections); + $phpargs = $testConfiguration->getPhpCommandLineArguments(); + $match = preg_match("/-d \"error_reporting=E_ALL | E_STRICT | E_DEPRECATED\" -d \"assert.active=1\"/",$phpargs); - $testConfiguration = new rtTestConfiguration($config, $this->sections); - $phpargs = $testConfiguration->getPhpCommandLineArguments(); - $match = preg_match("/-d \"error_reporting=E_ALL | E_STRICT | E_DEPRECATED\" -d \"assert.active=1\"/",$phpargs); - $this->assertEquals(1, $match); - } + $this->assertEquals(1, $match); + } } -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtTestDifferenceTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtTestDifferenceTest.php diff -u phpruntests/tests/testcase/rtTestDifferenceTest.php:1.1.1.1 phpruntests/tests/testcase/rtTestDifferenceTest.php:1.2 --- phpruntests/tests/testcase/rtTestDifferenceTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtTestDifferenceTest.php Wed Apr 22 09:14:51 2009 @@ -1,20 +1,18 @@ <?php - require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - class rtTestDifferenceTest extends PHPUnit_Framework_TestCase { - - public function testTestDifference() { - - $expectSection = new rtExpectSection('EXPECT',array('Hello World')); - $testDifference = new rtTestDifference($expectSection, 'Hello Dolly'); - - $difference = $testDifference->getDifference(); - $this->assertEquals('001+ Hello Dolly', $difference[0]); - $this->assertEquals('001- Hello World', $difference[1]); +class rtTestDifferenceTest extends PHPUnit_Framework_TestCase +{ + public function testTestDifference() + { + $expectSection = new rtExpectSection('EXPECT',array('Hello World')); + $testDifference = new rtTestDifference($expectSection, 'Hello Dolly'); + + $difference = $testDifference->getDifference(); + $this->assertEquals('001+ Hello Dolly', $difference[0]); + $this->assertEquals('001- Hello World', $difference[1]); } - } -?> \ No newline at end of file +} +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtTestExecutionTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtTestExecutionTest.php diff -u phpruntests/tests/testcase/rtTestExecutionTest.php:1.1.1.1 phpruntests/tests/testcase/rtTestExecutionTest.php:1.2 --- phpruntests/tests/testcase/rtTestExecutionTest.php:1.1.1.1 Wed Apr 15 16:30:21 2009 +++ phpruntests/tests/testcase/rtTestExecutionTest.php Wed Apr 22 09:14:51 2009 @@ -1,141 +1,135 @@ <?php - require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - - class rtTestExecutionTest extends PHPUnit_Framework_TestCase - { +class rtTestExecutionTest extends PHPUnit_Framework_TestCase +{ private $path_to_tests; private $sample_test; private $sample_expectf; private $sample_expecregex; private $php; - - 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_test.phpt'; - $this->sample_expectf = $this->path_to_tests . '/sample_expectf.phpt'; - $this->sample_expectregex = $this->path_to_tests . '/sample_expectregex.phpt'; - - } - - public function tearDown() { - @unlink($this->path_to_tests . '/sample_test.php'); - @unlink($this->path_to_tests. '/sample_expectf.php'); - @unlink($this->path_to_tests. '/sample_expectregex.php'); - } - - public function testFileRun() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //Grab the output - $this->assertEquals('Hello world', trim($testCase->getOutput())); - - } - - public function testFileRunAndCompare() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //check the output - $testCase->compareOutput(); - - //Check the exit status - $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); - - } - - - public function testExpectFFileRunAndCompare() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_expectf)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //check the output - $testCase->compareOutput(); - - //Check the exit status - $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); - - } - - public function testExpectRegexFileRunAndCompare() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_expectregex)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - //check the output - $testCase->compareOutput(); - - //Check the exit status - $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); - - } - } - - - -?> \ No newline at end of file + + 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_test.phpt'; + $this->sample_expectf = $this->path_to_tests . '/sample_expectf.phpt'; + $this->sample_expectregex = $this->path_to_tests . '/sample_expectregex.phpt'; + } + + public function tearDown() + { + @unlink($this->path_to_tests . '/sample_test.php'); + @unlink($this->path_to_tests . '/sample_expectf.php'); + @unlink($this->path_to_tests . '/sample_expectregex.php'); + } + + public function testFileRun() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //Grab the output + $this->assertEquals('Hello world', trim($testCase->getOutput())); + } + + public function testFileRunAndCompare() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //check the output + $testCase->compareOutput(); + + //Check the exit status + $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); + } + + public function testExpectFFileRunAndCompare() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_expectf)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //check the output + $testCase->compareOutput(); + + //Check the exit status + $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); + } + + public function testExpectRegexFileRunAndCompare() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_expectregex)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + //check the output + $testCase->compareOutput(); + + //Check the exit status + $this->assertTrue(array_key_exists('pass', $testCase->getStatus())); + } +} +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtTestOutputWriterTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtTestOutputWriterTest.php diff -u phpruntests/tests/testcase/rtTestOutputWriterTest.php:1.1.1.1 phpruntests/tests/testcase/rtTestOutputWriterTest.php:1.2 --- phpruntests/tests/testcase/rtTestOutputWriterTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtTestOutputWriterTest.php Wed Apr 22 09:14:51 2009 @@ -3,60 +3,56 @@ require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtTestOutputWriterTest 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_test.phpt'; + $this->sample_test_fail = $this->path_to_tests . '/sample_test_fail.phpt'; + $this->sample_skipif = $this->path_to_tests . '/sample_skipif.phpt'; + } + + public function tearDown() + { + @unlink($this->sample_test = $this->path_to_tests . '/sample_test.php'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test.out'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test.exp'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test_fail.diff'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test_fail.exp'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test_fail.out'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_test_fail.php'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_skipif.skipif.php'); + @unlink($this->sample_test = $this->path_to_tests . '/sample_skipif.php'); + } + + public function testFailedTest() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test_fail)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile = new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); -class rtTestOutputWriterTest 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_test.phpt'; - $this->sample_test_fail = $this->path_to_tests. '/sample_test_fail.phpt'; - $this->sample_skipif = $this->path_to_tests. '/sample_skipif.phpt'; - } - - public function tearDown() { - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.out'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.exp'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.diff'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.exp'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.out'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.skipif.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.php'); - } - - public function testFailedTest() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test_fail)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - - $testOutputWriter = rtTestOutputWriter::getInstance(array($results), 'list'); - $this->assertEquals('rtTestOutputWriterList', get_class($testOutputWriter)); - + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); - } + $testOutputWriter = rtTestOutputWriter::getInstance(array($results), 'list'); + $this->assertEquals('rtTestOutputWriterList', get_class($testOutputWriter)); + } } -?> \ No newline at end of file +?> http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtTestResultsTest.php?r1=1.1.1.1&r2=1.2&diff_format=u Index: phpruntests/tests/testcase/rtTestResultsTest.php diff -u phpruntests/tests/testcase/rtTestResultsTest.php:1.1.1.1 phpruntests/tests/testcase/rtTestResultsTest.php:1.2 --- phpruntests/tests/testcase/rtTestResultsTest.php:1.1.1.1 Wed Apr 15 16:30:20 2009 +++ phpruntests/tests/testcase/rtTestResultsTest.php Wed Apr 22 09:14:51 2009 @@ -1,268 +1,255 @@ <?php - require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtTestResultsTest 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_test.phpt'; + $this->sample_test_fail = $this->path_to_tests. '/sample_test_fail.phpt'; + $this->sample_skipif = $this->path_to_tests. '/sample_skipif.phpt'; + $this->sample_clean = $this->path_to_tests. '/sample_clean.phpt'; + $this->sample_bork = $this->path_to_tests. '/sample_bork.phpt'; + } + + public function tearDown() + { + @unlink($this->sample_test = $this->path_to_tests. '/sample_test.php'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test.out'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test.exp'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.diff'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.exp'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.out'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.php'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.skipif.php'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.php'); + @unlink($this->sample_test = $this->path_to_tests. '/sample_clean.php'); + } + + public function testFileDelete() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); -class rtTestResultsTest extends PHPUnit_Framework_TestCase { + //Setup and set the local environment for the test case + $testCase->executeTest($config); - 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_test.phpt'; - $this->sample_test_fail = $this->path_to_tests. '/sample_test_fail.phpt'; - $this->sample_skipif = $this->path_to_tests. '/sample_skipif.phpt'; - $this->sample_clean = $this->path_to_tests. '/sample_clean.phpt'; - $this->sample_bork = $this->path_to_tests. '/sample_bork.phpt'; - } - - public function tearDown() { - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.out'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test.exp'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.diff'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.exp'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.out'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_test_fail.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.skipif.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_skipif.php'); - @unlink($this->sample_test = $this->path_to_tests. '/sample_clean.php'); - } - - public function testFileDelete() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - $fileName = $testFile->getTestName(). ".php"; - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - - $this->assertFalse(file_exists($fileName)); - - } - - public function testFileSaveAll() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test, '--keep-all')); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - $fileName = $testFile->getTestName(). ".php"; - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - $this->assertTrue(file_exists($fileName)); - - } - - public function testFileSavePHP() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test, '--keep-php')); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - $fileName = $testFile->getTestName(). ".php"; - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - $this->assertTrue(file_exists($fileName)); - - - } - - public function testFailedTest() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test_fail)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - $testName = $testFile->getTestName(); - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - $this->assertTrue(file_exists($testName.'.diff')); - $this->assertTrue(file_exists($testName.'.out')); - $this->assertTrue(file_exists($testName.'.exp')); - $this->assertTrue(file_exists($testName.'.php')); - - - } - - public function testSkippedTest() { - - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_skipif)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - $testName = $testFile->getTestName(); - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - $this->assertFalse(file_exists($testName.'.skipif.php')); - $this->assertFalse(file_exists($testName.'.php')); - - - } - - public function testSkippedTestKeep() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_skipif, '--keep-all')); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - $testName = $testFile->getTestName(); - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - - - $this->assertTrue(file_exists($testName.'.skipif.php')); - } - - public function testCleanPass() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_clean)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - //Create a new test case - $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); - - //Setup and set the local environment for the test case - $testCase->executeTest($config); - - - $testName = $testFile->getTestName(); - - $results = new rtTestResults($testCase); - $results->processResults($testCase, $config); - $this->assertTrue(array_key_exists('pass', $results->getStatus())); - - } - - public function testBork() { - //Create a new test configuration - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_bork)); - $config->configure(); - - //Retrieve the array of test file names - $testFiles = $config->getSetting('TestFiles'); - - //Read the test file - $testFile =new rtPhpTestFile(); - $testFile->doRead($testFiles[0]); - $testFile->normaliseLineEndings(); - - if(!$testFile->arePreConditionsMet()) { - - $results = new rtTestResults(null, "borked", $testFiles[0]); - $this->assertTrue(array_key_exists('bork', $results->getStatus())); - + $fileName = $testFile->getTestName(). ".php"; + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertFalse(file_exists($fileName)); } - } + public function testFileSaveAll() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test, '--keep-all')); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $fileName = $testFile->getTestName(). ".php"; + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertTrue(file_exists($fileName)); + } + + public function testFileSavePHP() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test, '--keep-php')); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),$testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $fileName = $testFile->getTestName(). ".php"; + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertTrue(file_exists($fileName)); + } + + public function testFailedTest() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test_fail)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $testName = $testFile->getTestName(); + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertTrue(file_exists($testName.'.diff')); + $this->assertTrue(file_exists($testName.'.out')); + $this->assertTrue(file_exists($testName.'.exp')); + $this->assertTrue(file_exists($testName.'.php')); + } + + public function testSkippedTest() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_skipif)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $testName = $testFile->getTestName(); + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertFalse(file_exists($testName.'.skipif.php')); + $this->assertFalse(file_exists($testName.'.php')); + } + + public function testSkippedTestKeep() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_skipif, '--keep-all')); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $testName = $testFile->getTestName(); + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertTrue(file_exists($testName.'.skipif.php')); + } + + public function testCleanPass() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_clean)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(),$config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + + $testName = $testFile->getTestName(); + + $results = new rtTestResults($testCase); + $results->processResults($testCase, $config); + + $this->assertTrue(array_key_exists('pass', $results->getStatus())); + } + + public function testBork() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_bork)); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile =new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + if(!$testFile->arePreConditionsMet()) { + + $results = new rtTestResults(null, "borked", $testFiles[0]); + + $this->assertTrue(array_key_exists('bork', $results->getStatus())); + } + } } -?> \ No newline at end of file +?>
« previous php.cvs (#57128) next »