com phpruntests: Reformatted to conform to PEAR coding standards.: tests/configuration/preconditions/rtIfParallelHasPcntlTest.php
tests/configuration/preconditions/rtIsExecutableSetTest.php tests/configuration/preconditions/rtIsPcreLoadedTest.php
tests/configuration/preconditions/rtIsProcOpenAvailableTest.php tests/configuration/preconditions/rtIsSafeModeDisabledTest.php
tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php tests/config
| From: | David Soria Parra | Date: | Mon, 20 Apr 2009 20:50:39 +0000 |
| Subject: | com phpruntests: Reformatted to conform to PEAR coding standards.: tests/configuration/preconditions/rtIfParallelHasPcntlTest.php tests/configuration/preconditions/rtIsExecutableSetTest.php tests/configuration/preconditions/rtIsPcreLoadedTest.php tests/configuration/preconditions/rtIsProcOpenAvailableTest.php tests/configuration/preconditions/rtIsSafeModeDisabledTest.php tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php tests/config |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66543@lists.php.net to get a copy of this message | ||
Commit: e552dcc9d8188cd6f4d36c60f0bbf054046f1f24
Author: Stefan Priebsch <spriebsch@php.net> Mon, 20 Apr 2009 20:50:39 +0000
Parents: e311693412c35efb4fd377f8f6364775f2bbe77c
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=e552dcc9d8188cd6f4d36c60f0bbf054046f1f24
Log:
Reformatted to conform to PEAR coding standards.
Changed paths:
M tests/configuration/preconditions/rtIfParallelHasPcntlTest.php
M tests/configuration/preconditions/rtIsExecutableSetTest.php
M tests/configuration/preconditions/rtIsPcreLoadedTest.php
M tests/configuration/preconditions/rtIsProcOpenAvailableTest.php
M tests/configuration/preconditions/rtIsSafeModeDisabledTest..php
M tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php
M tests/configuration/rtAddToCommandLineTest.php
M tests/configuration/rtCommandLineOptionsTest.php
M tests/configuration/rtDirectoryListTest.php
M tests/configuration/rtEnvironmentVariablesTest.php
M tests/configuration/rtIniAsCommandLineArgsTest.php
M tests/configuration/rtPreconditionListTest.php
M tests/configuration/rtRuntestsConfigurationTest.php
M tests/configuration/settings/rtCurrentDirectorySettingTest.php
M tests/configuration/settings/rtLogFormatSettingTest.php
M tests/configuration/settings/rtPhpCgiExecutableSettingTest.php
M tests/configuration/settings/rtPhpCommandLineArgSettingTest.php
M tests/configuration/settings/rtPhpExecutableSettingTest.php
M tests/configuration/settings/rtTestDirectorySettingTest.php
M tests/configuration/settings/rtTestFileSettingTest.php
M tests/configuration/settings/rtWorkingDirectorySettingTest.php
diff --git a/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php b/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php index 106e80b..832d83c 100644 --- a/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php +++ b/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php @@ -1,40 +1,49 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIfParallelHasPcntlTest extends PHPUnit_Framework_TestCase { - public function testLoaded() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-z')); - $env = rtEnvironmentVariables::getInstance(); + public function testLoaded() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-z')); + $env = rtEnvironmentVariables::getInstance(); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } - - public function testLoaded2() { - $clo = new rtCommandLineOptions(); - $env = rtEnvironmentVariables::getInstance(); - $env->setVariable('TEST_PHP_PARALLEL', true); + public function testLoaded2() + { + $clo = new rtCommandLineOptions(); + $env = rtEnvironmentVariables::getInstance(); + $env->setVariable('TEST_PHP_PARALLEL', true); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } + public function testNotRequired() + { + $clo = new rtCommandLineOptions(); + $env = rtEnvironmentVariables::getInstance(); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testgetMessage() + { + $pre = new rtIfParallelHasPcntl(); - public function testNotRequired() { - $clo = new rtCommandLineOptions(); - $env = rtEnvironmentVariables::getInstance(); + $this->assertEquals($pre->getMessage('pcntlNotLoaded'), rtText::get('pcntlNotLoaded')); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } - public function testgetMessage() { - $pre = new rtIfParallelHasPcntl(); - $this->assertEquals($pre->getMessage('pcntlNotLoaded'), rtText::get('pcntlNotLoaded')); - } - - //Not sure how to check if it's not loaded? + //Not sure how to check if it's not loaded? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsExecutableSetTest.php b/tests/configuration/preconditions/rtIsExecutableSetTest.php index 9da66be..51f8681 100644 --- a/tests/configuration/preconditions/rtIsExecutableSetTest.php +++ b/tests/configuration/preconditions/rtIsExecutableSetTest.php @@ -1,30 +1,37 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsExecutableSetTest extends PHPUnit_Framework_TestCase - { - public function testClOption() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-p', 'some-file')); - - $pre = new rtIsExecutableSet(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testEVOption() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $env->setVariable('TEST_PHP_EXECUTABLE','some-executable'); - - $pre = new rtIsExecutableSet(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testGetText() { - $pre = new rtIsExecutableSet(); - $this->assertEquals($pre->getMessage('missingPHPExecutable'),rtText::get('missingPHPExecutable')); - } - +{ + public function testClOption() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-p', 'some-file')); + + $pre = new rtIsExecutableSet(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testEVOption() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $env->setVariable('TEST_PHP_EXECUTABLE', 'some-executable'); + + $pre = new rtIsExecutableSet(); + + $this->assertTrue($pre->check($clo,$env)); + } + + public function testGetText() + { + $pre = new rtIsExecutableSet(); + + $this->assertEquals($pre->getMessage('missingPHPExecutable'), rtText::get('missingPHPExecutable')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsPcreLoadedTest.php b/tests/configuration/preconditions/rtIsPcreLoadedTest.php index 096ea26..2910e76 100644 --- a/tests/configuration/preconditions/rtIsPcreLoadedTest.php +++ b/tests/configuration/preconditions/rtIsPcreLoadedTest.php @@ -1,19 +1,22 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsPcreLoadedTest extends PHPUnit_Framework_TestCase { - public function testLoaded() { - $pre = new rtIsPcreLoaded(); - $this->assertTrue($pre->check()); - } -public function testgetMessage() { - $pre = new rtIsPcreLoaded(); - $this->assertEquals($pre->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); - } + public function testLoaded() + { + $pre = new rtIsPcreLoaded(); + $this->assertTrue($pre->check()); + } - //Not sure how to check if it's not loaded? + public function testgetMessage() + { + $pre = new rtIsPcreLoaded(); + $this->assertEquals($pre->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); + } + + //Not sure how to check if it's not loaded? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php index b8b2bc6..21b2d07 100644 --- a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php +++ b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php @@ -1,19 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsProcOpenAvailableTest extends PHPUnit_Framework_TestCase { - public function testAvailable() { - $pre = new rtIsProcOpenAvailable(); - $this->assertTrue($pre->check()); - } -public function testgetMessage() { - $pre = new rtIsProcOpenAvailable(); - $this->assertEquals($pre->getMessage('procOpenNotAvailable'), rtText::get('procOpenNotAvailable')); - } - - //Not sure how to check if it is missing? + public function testAvailable() + { + $pre = new rtIsProcOpenAvailable(); + + $this->assertTrue($pre->check()); + } + + public function testgetMessage() + { + $pre = new rtIsProcOpenAvailable(); + + $this->assertEquals($pre->getMessage('procOpenNotAvailable'), rtText::get('procOpenNotAvailable')); + } + + //Not sure how to check if it is missing? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php b/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php index 5325d6b..a060774 100644 --- a/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php +++ b/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php @@ -1,19 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIssafeModeDisabledTest extends PHPUnit_Framework_TestCase { - public function testDisabled() { - $pre = new rtIsSafeModeDisabled(); - $this->assertTrue($pre->check()); - } - public function testgetMessage() { - $pre = new rtIsSafeModeDisabled(); - $this->assertEquals($pre->getMessage('safeModeNotDisabled'), rtText::get('safeModeNotDisabled')); - } - - //Not sure how to check if it is missing? + public function testDisabled() + { + $pre = new rtIsSafeModeDisabled(); + + $this->assertTrue($pre->check()); + } + + public function testgetMessage() + { + $pre = new rtIsSafeModeDisabled(); + + $this->assertEquals($pre->getMessage('safeModeNotDisabled'), rtText::get('safeModeNotDisabled')); + } + + //Not sure how to check if it is missing? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php b/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php index bfa132d..354ed85 100644 --- a/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php +++ b/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php @@ -1,53 +1,69 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsTestFileSpecifiedTest extends PHPUnit_Framework_TestCase - { - public function testClOptionR() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-r', 'some-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testCLOptionL() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l', 'some-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testCLOptionFileName() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'some-test-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testEnvVar() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $env->setvariable('TEST_PHP_USER','some-file'); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testNotSpecified() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - - $pre = new rtIsTestFileSpecified(); - $this->assertFalse($pre->check($clo,$env)); - } - public function testGetText() { - $pre = new rtIsTestFileSpecified(); - $this->assertEquals($pre->getMessage('missingTestFile'),rtText::get('missingTestFile')); - } - +{ + public function testClOptionR() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-r', 'some-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testCLOptionL( + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l', 'some-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testCLOptionFileName() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'some-test-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testEnvVar() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $env->setvariable('TEST_PHP_USER', 'some-file'); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testNotSpecified() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + + $pre = new rtIsTestFileSpecified(); + + $this->assertFalse($pre->check($clo, $env)); + } + + public function testGetText() + { + $pre = new rtIsTestFileSpecified(); + + $this->assertEquals($pre->getMessage('missingTestFile'), rtText::get('missingTestFile')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtAddToCommandLineTest.php b/tests/configuration/rtAddToCommandLineTest.php index b773800..ec38a90 100644 --- a/tests/configuration/rtAddToCommandLineTest.php +++ b/tests/configuration/rtAddToCommandLineTest.php @@ -1,21 +1,22 @@ <?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 rtAddToCommandLineTest extends PHPUnit_Framework_TestCase - { - public function testAdd() { - $commandLine = new rtCommandLineOptions(); - $commandLine->parse(array('run-tests.php', '-n')); - - $env = rtEnvironmentVariables::getInstance(); - $env->setVariable('TEST_PHP_ARGS', '-p a-php-executable'); - - $commandLineAdd = new rtAddToCommandLine(); - $commandLineAdd->parseAdditionalOptions($commandLine, $env); - - $this->assertTrue($commandLine->hasOption('p')); +class rtAddToCommandLineTest extends PHPUnit_Framework_TestCase +{ + public function testAdd() + { + $commandLine = new rtCommandLineOptions(); + $commandLine->parse(array('run-tests.php', '-n')); + + $env = rtEnvironmentVariables::getInstance(); + $env->setVariable('TEST_PHP_ARGS', '-p a-php-executable'); + + $commandLineAdd = new rtAddToCommandLine(); + $commandLineAdd->parseAdditionalOptions($commandLine, $env); + + $this->assertTrue($commandLine->hasOption('p')); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/rtCommandLineOptionsTest.php b/tests/configuration/rtCommandLineOptionsTest.php index 97c3e92..a173ec9 100644 --- a/tests/configuration/rtCommandLineOptionsTest.php +++ b/tests/configuration/rtCommandLineOptionsTest.php @@ -1,85 +1,101 @@ <?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 rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase +{ + public function testNoOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php')); + $fileArray = $clo->getTestFilename(); - class rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase - { - public function testNoOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php')); - $fileArray = $clo->getTestFilename(); - $this->assertTrue(is_array($fileArray)); + $this->assertTrue(is_array($fileArray)); } - public function testShortOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-n')); - $this->assertTrue($clo->hasOption('n')); + public function testShortOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-n')); + + $this->assertTrue($clo->hasOption('n')); } - public function testLongOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--help')); - $this->assertTrue($clo->hasOption('help')); + public function testLongOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--help')); + + $this->assertTrue($clo->hasOption('help')); } - public function testShortOptionWithArg() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l', 'the-l-arg')); - $this->assertTrue($clo->hasOption('l')); - $this->assertEquals('the-l-arg', $clo->getOption('l')); + public function testShortOptionWithArg() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l', 'the-l-arg')); + + $this->assertTrue($clo->hasOption('l')); + $this->assertEquals('the-l-arg', $clo->getOption('l')); } - public function testLongOptionWithArg() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--html', 'the-html-arg')); - $this->assertTrue($clo->hasOption('html')); - $this->assertEquals('the-html-arg', $clo->getOption('html')); + public function testLongOptionWithArg() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--html', 'the-html-arg')); + + $this->assertTrue($clo->hasOption('html')); + $this->assertEquals('the-html-arg', $clo->getOption('html')); } - public function testNonexistingOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php')); - $this->assertFalse($clo->hasOption('nonexisting')); - // test for exception when calling getRunOption('nonexisting')? + public function testNonexistingOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php')); + + $this->assertFalse($clo->hasOption('nonexisting')); + // test for exception when calling getRunOption('nonexisting')? } - /** - * @expectedException RuntimeException - */ - public function testMissingShortOptionArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l')); - $clo->getOption('l'); + /** + * @expectedException RuntimeException + */ + public function testMissingShortOptionArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l')); + $clo->getOption('l'); } - /** - * @expectedException RuntimeException - */ - public function testMissingLongOptionArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--html')); - $clo->getOption('html'); + /** + * @expectedException RuntimeException + */ + public function testMissingLongOptionArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--html')); + $clo->getOption('html'); } - public function testFileArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'the-filename')); - $fileArray = $clo->getTestFilename(); - $this->assertEquals('the-filename', $fileArray[0]); + public function testFileArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'the-filename')); + $fileArray = $clo->getTestFilename(); + + $this->assertEquals('the-filename', $fileArray[0]); } - public function testManyFileArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'the-filename1', 'the-filename2')); - $fileArray = $clo->getTestFilename(); - $this->assertEquals('the-filename2', $fileArray[1]); + public function testManyFileArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'the-filename1', 'the-filename2')); + $fileArray = $clo->getTestFilename(); + + $this->assertEquals('the-filename2', $fileArray[1]); } // a nasty case is a filename starting with - or -- // the filename should be quoted in that case - } - +} ?> diff --git a/tests/configuration/rtDirectoryListTest.php b/tests/configuration/rtDirectoryListTest.php index f7df000..717a9b4 100644 --- a/tests/configuration/rtDirectoryListTest.php +++ b/tests/configuration/rtDirectoryListTest.php @@ -1,50 +1,48 @@ <?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 rtDirectoryListTestTest extends PHPUnit_Framework_TestCase - { - - public function setUp() { - $tmpDir = sys_get_temp_dir(). "/top"; - mkdir ($tmpDir); - mkdir ($tmpDir. "/a"); - mkdir ($tmpDir. "/b"); - mkdir ($tmpDir. "/c"); - file_put_contents($tmpDir. "/c/afile", "hello"); - mkdir ($tmpDir. "/c/d"); +class rtDirectoryListTestTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $tmpDir = sys_get_temp_dir(). "/top"; + mkdir ($tmpDir); + mkdir ($tmpDir. "/a"); + mkdir ($tmpDir. "/b"); + mkdir ($tmpDir. "/c"); + file_put_contents($tmpDir. "/c/afile", "hello"); + mkdir ($tmpDir. "/c/d"); } - - - public function tearDown() { - $tmpDir = sys_get_temp_dir(). "/top"; - rmdir ($tmpDir. "/a"); - rmdir ($tmpDir. "/b"); - - unlink ($tmpDir. "/c/afile"); - rmdir ($tmpDir. "/c/d"); - rmdir ($tmpDir. "/c"); - rmdir ($tmpDir); + + public function tearDown() + { + $tmpDir = sys_get_temp_dir(). "/top"; + rmdir ($tmpDir. "/a"); + rmdir ($tmpDir. "/b"); + + unlink ($tmpDir. "/c/afile"); + rmdir ($tmpDir. "/c/d"); + rmdir ($tmpDir. "/c"); + rmdir ($tmpDir); } - - public function testNames() { - $directoryList = new rtDirectoryList(); - $top = sys_get_temp_dir(). "/top"; - $list = $directoryList->getSubDirectoryPaths($top); - $this->assertEquals(true, in_array($top . "/a", $list)); - $this->assertEquals(true, in_array($top . "/c/d", $list)); + public function testNames() + { + $directoryList = new rtDirectoryList(); + $top = sys_get_temp_dir(). "/top"; + $list = $directoryList->getSubDirectoryPaths($top); + $this->assertEquals(true, in_array($top . "/a", $list)); + $this->assertEquals(true, in_array($top . "/c/d", $list)); } - - - public function testList() { - $directoryList = new rtDirectoryList(); - $top = sys_get_temp_dir(). "/top"; - $list = $directoryList->getSubDirectoryPaths($top); - $this->assertEquals(5, count($list)); - + + public function testList() + { + $directoryList = new rtDirectoryList(); + $top = sys_get_temp_dir(). "/top"; + $list = $directoryList->getSubDirectoryPaths($top); + $this->assertEquals(5, count($list)); } - - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/rtEnvironmentVariablesTest.php b/tests/configuration/rtEnvironmentVariablesTest.php index b535935..e825758 100644 --- a/tests/configuration/rtEnvironmentVariablesTest.php +++ b/tests/configuration/rtEnvironmentVariablesTest.php @@ -1,53 +1,56 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - -class rtEnvironmentVariablesTest extends PHPUnit_Framework_TestCase { - - public function setUp() { - putenv('TEST_PHP_EXECUTABLE'); - putenv('TEST_PHP_CGI_EXECUTABLE'); - putenv('TEST_PHP_ARGS'); - putenv('TEST_PHP_SRCDIR'); - putenv('TEST_PHP_LOG_FORMAT'); - putenv('TEST_PHP_DETAILED'); - putenv('TEST_PHP_USER'); - putenv('TEST_PHP_PARALLEL'); - putenv('NO_INTERACTION'); - putenv('PHP_AUTOCONF'); - putenv('TEST_PHP_ARGS'); - putenv('REPORT_EXIT_STATUS'); - putenv('TEST_PHP_ERROR_STYLE'); - putenv('NO_PHPTEST_SUMMARY'); - putenv('SystemRoot'); - - } - - - public function testGetVariable() { - putenv('TEST_PHP_EXECUTABLE=some-executable'); - $ev = rtEnvironmentVariables::getInstance(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('some-executable', $ev->getVariable('TEST_PHP_EXECUTABLE')); - } - - public function testAdaptUnix() { - putenv('TEST_PHP_PARALLEL=a-parallel-run'); - $ev = rtEnvironmentVariables::getInstance(); - $ev->adaptEnvironment(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('a-parallel-run', $ev->getVariable('TEST_PHP_PARALLEL')); - } +class rtEnvironmentVariablesTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + putenv('TEST_PHP_EXECUTABLE'); + putenv('TEST_PHP_CGI_EXECUTABLE'); + putenv('TEST_PHP_ARGS'); + putenv('TEST_PHP_SRCDIR'); + putenv('TEST_PHP_LOG_FORMAT'); + putenv('TEST_PHP_DETAILED'); + putenv('TEST_PHP_USER'); + putenv('TEST_PHP_PARALLEL'); + putenv('NO_INTERACTION'); + putenv('PHP_AUTOCONF'); + putenv('TEST_PHP_ARGS'); + putenv('REPORT_EXIT_STATUS'); + putenv('TEST_PHP_ERROR_STYLE'); + putenv('NO_PHPTEST_SUMMARY'); + putenv('SystemRoot'); + } + + public function testGetVariable() + { + putenv('TEST_PHP_EXECUTABLE=some-executable'); + $ev = rtEnvironmentVariables::getInstance(); + $ev->getUserSuppliedVariables(); + + $this->assertEquals('some-executable', $ev->getVariable('TEST_PHP_EXECUTABLE')); + } + + public function testAdaptUnix() + { + putenv('TEST_PHP_PARALLEL=a-parallel-run'); + $ev = rtEnvironmentVariables::getInstance(); + $ev->adaptEnvironment(); + $ev->getUserSuppliedVariables(); + + $this->assertEquals('a-parallel-run', $ev->getVariable('TEST_PHP_PARALLEL')); + } + + public function testAdaptWin() + { + putenv('SystemRoot=some-windows-thing'); + $ev = rtEnvironmentVariables::getInstance('Windows'); + $ev->adaptEnvironment(); + $ev->getUserSuppliedVariables(); - public function testAdaptWin() { - putenv('SystemRoot=some-windows-thing'); - $ev = rtEnvironmentVariables::getInstance('Windows'); - $ev->adaptEnvironment(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('some-windows-thing', $ev->getVariable('SystemRoot')); - } - - + $this->assertEquals('some-windows-thing', $ev->getVariable('SystemRoot')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtIniAsCommandLineArgsTest.php b/tests/configuration/rtIniAsCommandLineArgsTest.php index 8f3fd73..4a37987 100644 --- a/tests/configuration/rtIniAsCommandLineArgsTest.php +++ b/tests/configuration/rtIniAsCommandLineArgsTest.php @@ -5,55 +5,63 @@ require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; class rtIniAsCommandLineArgsTest extends PHPUnit_Framework_TestCase { - public function testPreSet() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $last49 = addslashes(substr($iniSet->getBasePhpDArgs(), -49)); - $this->assertEquals($last49, '-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"'); - } - - public function testAddFromArray() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('f=g'), $iniSet->getBasePhpDArgs()); - $last38= addslashes(substr($addStr, -38)); - $this->assertEquals($last38, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"f=g\"'); - } - - public function testAddFromArray2() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('a='), $iniSet->getBasePhpDArgs()); - $last37= addslashes(substr($addStr, -37)); - $this->assertEquals($last37, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"a=\"'); - } - - public function testExtraSpaces() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('a = f'), $iniSet->getBasePhpDArgs()); - $last37= addslashes(substr($addStr, -37)); - $this->assertEquals($last37, 'r_mode=U_INVALID_SUBSTITUTE\" -d \"a=f\"'); - } - - /** - * @expectedException rtUnknownIniSettingException - */ - public function testInvalidArg() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af'), $iniSet->getBasePhpDArgs()); - } - - /** - * @expectedException rtUnknownIniSettingException - */ - public function testInvalidArg2() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af=be=blah'), $iniSet->getBasePhpDArgs()); - } -} -?> + public function testPreSet() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $last49 = addslashes(substr($iniSet->getBasePhpDArgs(), -49)); + + $this->assertEquals($last49, '-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"'); + } + + public function testAddFromArray() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('f=g'), $iniSet->getBasePhpDArgs()); + $last38= addslashes(substr($addStr, -38)); + + $this->assertEquals($last38, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"f=g\"'); + } + + public function testAddFromArray2() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('a='), $iniSet->getBasePhpDArgs()); + $last37= addslashes(substr($addStr, -37)); + $this->assertEquals($last37, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"a=\"'); + } + public function testExtraSpaces() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('a = f'), $iniSet->getBasePhpDArgs()); + $last37= addslashes(substr($addStr, -37)); + + $this->assertEquals($last37, 'r_mode=U_INVALID_SUBSTITUTE\" -d \"a=f\"'); + } + + /** + * @expectedException rtUnknownIniSettingException + */ + public function testInvalidArg() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('af'), $iniSet->getBasePhpDArgs()); + } + + /** + * @expectedException rtUnknownIniSettingException + */ + public function testInvalidArg2() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('af=be=blah'), $iniSet->getBasePhpDArgs()); + } +} +?> diff --git a/tests/configuration/rtPreconditionListTest.php b/tests/configuration/rtPreconditionListTest.php index 59b98a0..6c7f43e 100644 --- a/tests/configuration/rtPreconditionListTest.php +++ b/tests/configuration/rtPreconditionListTest.php @@ -1,32 +1,36 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtPreCondtionListTest extends PHPUnit_Framework_TestCase +{ + protected $clo; + protected $env; + protected $ge; + + public function setUp() + { + $this->clo = new rtCommandLineOptions(); + $this->clo->parse(array('run-tests.php', '-p', 'some-php-exe', 'a-test.phpt')); + + $this->env = rtEnvironmentVariables::getInstance(); + $this->env->getUserSuppliedVariables(); + } + + public function testCheck() + { + $sl = rtPreConditionList::getInstance(); -class rtPreCondtionListTest extends PHPUnit_Framework_TestCase { - - protected $clo; - protected $env; - protected $ge; - - public function setUp() { - $this->clo = new rtCommandLineOptions(); - $this->clo->parse(array('run-tests.php', '-p', 'some-php-exe', 'a-test.phpt')); - - $this->env = rtEnvironmentVariables::getInstance(); - $this->env->getUserSuppliedVariables(); + $this->assertTrue($sl->check($this->clo, $this->env)); + } - } - - public function testCheck() { - $sl = rtPreConditionList::getInstance(); - $this->assertTrue($sl->check($this->clo, $this->env)); - } - - public function testUnix() { - $sl = rtPreConditionList::getInstance(); - $sl->adaptList(); - $this->assertTrue($sl->hasPreCondition('rtIfParallelHasPcntl')); - } + public function testUnix() + { + $sl = rtPreConditionList::getInstance(); + $sl->adaptList(); + + $this->assertTrue($sl->hasPreCondition('rtIfParallelHasPcntl')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtRuntestsConfigurationTest.php b/tests/configuration/rtRuntestsConfigurationTest.php index d065ae4..b8f0fc6 100644 --- a/tests/configuration/rtRuntestsConfigurationTest.php +++ b/tests/configuration/rtRuntestsConfigurationTest.php @@ -1,26 +1,30 @@ <?php + require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtRuntestsConfigurationTest extends PHPUnit_Framework_TestCase +{ + public function testCreateUnix() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); + + $testFiles = $config->getSetting('TestFiles'); - class rtRuntestsConfigurationTest extends PHPUnit_Framework_TestCase { - - public function testCreateUnix() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); - - $testFiles = $config->getSetting('TestFiles'); - $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); - $this->assertEquals('test.phpt', $testFiles[0]); + $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); + $this->assertEquals('test.phpt', $testFiles[0]); } - - public function testCreateWin() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt'),'Windows'); - $config->configure(); - - $testFiles = $config->getSetting('TestFiles'); - $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); - $this->assertEquals('test.phpt', $testFiles[0]); + + public function testCreateWin() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt'),'Windows'); + $config->configure(); + + $testFiles = $config->getSetting('TestFiles'); + + $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); + $this->assertEquals('test.phpt', $testFiles[0]); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtCurrentDirectorySettingTest.php b/tests/configuration/settings/rtCurrentDirectorySettingTest.php index 159ed66..221320a 100644 --- a/tests/configuration/settings/rtCurrentDirectorySettingTest.php +++ b/tests/configuration/settings/rtCurrentDirectorySettingTest.php @@ -1,15 +1,16 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetting() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $dirsetting = new rtCurrentDirectorySetting($configuration); -class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase { - - public function testSetting() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $dirsetting = new rtCurrentDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); - } - + $this->assertEquals(getcwd(), $dirsetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtLogFormatSettingTest.php b/tests/configuration/settings/rtLogFormatSettingTest.php index 810dc0e..e2db2e9 100644 --- a/tests/configuration/settings/rtLogFormatSettingTest.php +++ b/tests/configuration/settings/rtLogFormatSettingTest.php @@ -1,23 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtLogFormatSettingTest extends PHPUnit_Framework_TestCase +{ + public function testByEnvironmentSetting() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_LOG_FORMAT', 'some-log-format'); -class rtLogFormatSettingTest extends PHPUnit_Framework_TestCase { - - public function testByEnvironmentSetting() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_LOG_FORMAT', 'some-log-format'); + $logsetting = new rtLogFormatSetting($configuration); - $logsetting = new rtLogFormatSetting($configuration); - $this->assertEquals('SOME-LOG-FORMAT', $logsetting->get()); - } + $this->assertEquals('SOME-LOG-FORMAT', $logsetting->get()); + } - public function testSetLEOD() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $logsetting = new rtLogFormatSetting($configuration); - $this->assertEquals('LEOD', $logsetting->get()); - } + public function testSetLEOD() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $logsetting = new rtLogFormatSetting($configuration); + $this->assertEquals('LEOD', $logsetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php index ef6058e..9bbfd09 100644 --- a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php @@ -1,38 +1,34 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetPhpCgiExecutableEV() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); -class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase { - - - - public function testSetPhpCgiExecutableEV() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); + $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $cgisetting->get()); + $this->assertEquals('a-php-executable', $cgisetting->get()); + } - } - public function testSetPhpCgiExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); + public function testSetPhpCgiExecutableEVAuto() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); - + $cgisetting = new rtPhpCgiExecutableSetting($configuration); - } + $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); + } - public function testSetPhpCgiExecutableNotSet() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - - $this->assertEquals(null, $cgisetting->get()); - - } + public function testSetPhpCgiExecutableNotSet() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + + $cgisetting = new rtPhpCgiExecutableSetting($configuration); + + $this->assertEquals(null, $cgisetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php b/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php index 8ccc89d..6f54aa1 100644 --- a/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php +++ b/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php @@ -1,19 +1,18 @@ <?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 rtCommandLineArgSettingTest extends PHPUnit_Framework_TestCase { - - public function testSet() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); - - $clArgsetting = new rtPhpCommandLineArgSetting($configuration); - - $last49 = addslashes(substr($clArgsetting->get(), -49)); - $this->assertEquals('-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"', $last49); - +class rtCommandLineArgSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); + + $clArgsetting = new rtPhpCommandLineArgSetting($configuration); + $last49 = addslashes(substr($clArgsetting->get(), -49)); + + $this->assertEquals('-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"', $last49); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtPhpExecutableSettingTest.php b/tests/configuration/settings/rtPhpExecutableSettingTest.php index 2ab855f..b6a3c70 100644 --- a/tests/configuration/settings/rtPhpExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpExecutableSettingTest.php @@ -1,38 +1,37 @@ <?php - require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - - - class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase { - - public function testSetPhpExecutable() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); - - $clisetting = new rtPhpExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $clisetting->get()); - + +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; + +class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetPhpExecutable() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('a-php-executable', $clisetting->get()); } - - public function testSetPhpExecutableEV() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php')); - $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'a-php-executable'); - - $clisetting = new rtPhpExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $clisetting->get()); - - - + + public function testSetPhpExecutableEV() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'a-php-executable'); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('a-php-executable', $clisetting->get()); } - public function testSetPhpExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); - - - $clisetting = new rtPhpExecutableSetting($configuration); - - $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); - + + public function testSetPhpExecutableEVAuto() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtTestDirectorySettingTest.php b/tests/configuration/settings/rtTestDirectorySettingTest.php index be7c5fd..c8bb64d 100644 --- a/tests/configuration/settings/rtTestDirectorySettingTest.php +++ b/tests/configuration/settings/rtTestDirectorySettingTest.php @@ -1,28 +1,28 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - -class rtTestDirectorySettingsTest extends PHPUnit_Framework_TestCase { - - private $d1; - private $d2; - - public function setUp() { - $this->d1 = sys_get_temp_dir(); - $this->d2 = sys_get_temp_dir(); - } - - public function testSet() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', $this->d1, $this->d2)); - $testdirsetting = new rtTestDirectorySetting($configuration); - - $dirlist = $testdirsetting->get(); - - $this->assertEquals($dirlist[0], $this->d1); - $this->assertEquals($dirlist[1], $this->d2); - - } +class rtTestDirectorySettingsTest extends PHPUnit_Framework_TestCase +{ + private $d1; + private $d2; + + public function setUp() + { + $this->d1 = sys_get_temp_dir(); + $this->d2 = sys_get_temp_dir(); + } + + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', $this->d1, $this->d2)); + $testdirsetting = new rtTestDirectorySetting($configuration); + + $dirlist = $testdirsetting->get(); + + $this->assertEquals($dirlist[0], $this->d1); + $this->assertEquals($dirlist[1], $this->d2); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtTestFileSettingTest.php b/tests/configuration/settings/rtTestFileSettingTest.php index 8713996..8ceb4b9 100644 --- a/tests/configuration/settings/rtTestFileSettingTest.php +++ b/tests/configuration/settings/rtTestFileSettingTest.php @@ -3,59 +3,64 @@ require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; -class rtTestFileSettingTest extends PHPUnit_Framework_TestCase { - - private $f1; - private $f2; - private $testnames = array( - '/a.phpt', - '/b.phpt', - '/c.phpt', - ); - - public function setUp() { - $this->f1 = sys_get_temp_dir()."/file1"; - $fh = fopen($this->f1, 'w'); - foreach($this->testnames as $line) { - fwrite($fh, sys_get_temp_dir().$line."\n"); +class rtTestFileSettingTest extends PHPUnit_Framework_TestCase +{ + private $f1; + private $f2; + private $testnames = array( + '/a.phpt', + '/b.phpt', + '/c.phpt', + ); + + public function setUp() + { + $this->f1 = sys_get_temp_dir() . "/file1"; + $fh = fopen($this->f1, 'w'); + + foreach($this->testnames as $line) { + fwrite($fh, sys_get_temp_dir() . $line . "\n"); + } + + fclose($fh); + } + + public function tearDown() + { + unlink($this->f1); + } + + public function testSetFileList() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'the-first-file.phpt', 'the-second-file.phpt' )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], 'the-first-file.phpt'); + $this->assertEquals($filelist[1], 'the-second-file.phpt'); + } + + public function testSetLOption() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-l', $this->f1 )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], sys_get_temp_dir() . '/a.phpt'); + $this->assertEquals($filelist[1], sys_get_temp_dir() . '/b.phpt'); + } + + public function testSetROption() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-r', $this->f1 )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], sys_get_temp_dir() . '/a.phpt'); + $this->assertEquals($filelist[1], sys_get_temp_dir() . '/b.phpt'); } - fclose($fh); - } - - public function tearDown() { - unlink($this->f1); - } - - public function testSetFileList() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'the-first-file.phpt', 'the-second-file.phpt' )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], 'the-first-file.phpt'); - $this->assertEquals($filelist[1], 'the-second-file.phpt'); - - } - - public function testSetLOption() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-l', $this->f1 )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], sys_get_temp_dir().'/a.phpt'); - $this->assertEquals($filelist[1], sys_get_temp_dir().'/b.phpt'); - - } - public function testSetROption() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-r', $this->f1 )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], sys_get_temp_dir().'/a.phpt'); - $this->assertEquals($filelist[1], sys_get_temp_dir().'/b.phpt'); - - } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtWorkingDirectorySettingTest.php b/tests/configuration/settings/rtWorkingDirectorySettingTest.php index 4f84b62..8731431 100644 --- a/tests/configuration/settings/rtWorkingDirectorySettingTest.php +++ b/tests/configuration/settings/rtWorkingDirectorySettingTest.php @@ -1,24 +1,25 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtWorkingDirectorySettingTest extends PHPUnit_Framework_TestCase +{ + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $dirsetting = new rtWorkingDirectorySetting($configuration); + $this->assertEquals(getcwd(), $dirsetting->get()); + } -class rtWorkingDirectorySettingTest extends PHPUnit_Framework_TestCase { - - public function testSet() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $dirsetting = new rtWorkingDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); - } - - public function testSetFromEnv() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', 'the-source-dir'); - $dirsetting = new rtWorkingDirectorySetting($configuration); - - $this->assertEquals('the-source-dir', $dirsetting->get()); - } + public function testSetFromEnv() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', 'the-source-dir'); + $dirsetting = new rtWorkingDirectorySetting($configuration); + $this->assertEquals('the-source-dir', $dirsetting->get()); + } } -?> \ No newline at end of file +?>
diff --git a/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php b/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php index 106e80b..832d83c 100644 --- a/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php +++ b/tests/configuration/preconditions/rtIfParallelHasPcntlTest.php @@ -1,40 +1,49 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIfParallelHasPcntlTest extends PHPUnit_Framework_TestCase { - public function testLoaded() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-z')); - $env = rtEnvironmentVariables::getInstance(); + public function testLoaded() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-z')); + $env = rtEnvironmentVariables::getInstance(); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } - - public function testLoaded2() { - $clo = new rtCommandLineOptions(); - $env = rtEnvironmentVariables::getInstance(); - $env->setVariable('TEST_PHP_PARALLEL', true); + public function testLoaded2() + { + $clo = new rtCommandLineOptions(); + $env = rtEnvironmentVariables::getInstance(); + $env->setVariable('TEST_PHP_PARALLEL', true); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } + public function testNotRequired() + { + $clo = new rtCommandLineOptions(); + $env = rtEnvironmentVariables::getInstance(); + + $pre = new rtIfParallelHasPcntl(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testgetMessage() + { + $pre = new rtIfParallelHasPcntl(); - public function testNotRequired() { - $clo = new rtCommandLineOptions(); - $env = rtEnvironmentVariables::getInstance(); + $this->assertEquals($pre->getMessage('pcntlNotLoaded'), rtText::get('pcntlNotLoaded')); + } - $pre = new rtIfParallelHasPcntl(); - $this->assertTrue($pre->check($clo, $env)); - } - public function testgetMessage() { - $pre = new rtIfParallelHasPcntl(); - $this->assertEquals($pre->getMessage('pcntlNotLoaded'), rtText::get('pcntlNotLoaded')); - } - - //Not sure how to check if it's not loaded? + //Not sure how to check if it's not loaded? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsExecutableSetTest.php b/tests/configuration/preconditions/rtIsExecutableSetTest.php index 9da66be..51f8681 100644 --- a/tests/configuration/preconditions/rtIsExecutableSetTest.php +++ b/tests/configuration/preconditions/rtIsExecutableSetTest.php @@ -1,30 +1,37 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsExecutableSetTest extends PHPUnit_Framework_TestCase - { - public function testClOption() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-p', 'some-file')); - - $pre = new rtIsExecutableSet(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testEVOption() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $env->setVariable('TEST_PHP_EXECUTABLE','some-executable'); - - $pre = new rtIsExecutableSet(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testGetText() { - $pre = new rtIsExecutableSet(); - $this->assertEquals($pre->getMessage('missingPHPExecutable'),rtText::get('missingPHPExecutable')); - } - +{ + public function testClOption() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-p', 'some-file')); + + $pre = new rtIsExecutableSet(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testEVOption() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $env->setVariable('TEST_PHP_EXECUTABLE', 'some-executable'); + + $pre = new rtIsExecutableSet(); + + $this->assertTrue($pre->check($clo,$env)); + } + + public function testGetText() + { + $pre = new rtIsExecutableSet(); + + $this->assertEquals($pre->getMessage('missingPHPExecutable'), rtText::get('missingPHPExecutable')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsPcreLoadedTest.php b/tests/configuration/preconditions/rtIsPcreLoadedTest.php index 096ea26..2910e76 100644 --- a/tests/configuration/preconditions/rtIsPcreLoadedTest.php +++ b/tests/configuration/preconditions/rtIsPcreLoadedTest.php @@ -1,19 +1,22 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsPcreLoadedTest extends PHPUnit_Framework_TestCase { - public function testLoaded() { - $pre = new rtIsPcreLoaded(); - $this->assertTrue($pre->check()); - } -public function testgetMessage() { - $pre = new rtIsPcreLoaded(); - $this->assertEquals($pre->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); - } + public function testLoaded() + { + $pre = new rtIsPcreLoaded(); + $this->assertTrue($pre->check()); + } - //Not sure how to check if it's not loaded? + public function testgetMessage() + { + $pre = new rtIsPcreLoaded(); + $this->assertEquals($pre->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); + } + + //Not sure how to check if it's not loaded? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php index b8b2bc6..21b2d07 100644 --- a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php +++ b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php @@ -1,19 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsProcOpenAvailableTest extends PHPUnit_Framework_TestCase { - public function testAvailable() { - $pre = new rtIsProcOpenAvailable(); - $this->assertTrue($pre->check()); - } -public function testgetMessage() { - $pre = new rtIsProcOpenAvailable(); - $this->assertEquals($pre->getMessage('procOpenNotAvailable'), rtText::get('procOpenNotAvailable')); - } - - //Not sure how to check if it is missing? + public function testAvailable() + { + $pre = new rtIsProcOpenAvailable(); + + $this->assertTrue($pre->check()); + } + + public function testgetMessage() + { + $pre = new rtIsProcOpenAvailable(); + + $this->assertEquals($pre->getMessage('procOpenNotAvailable'), rtText::get('procOpenNotAvailable')); + } + + //Not sure how to check if it is missing? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php b/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php index 5325d6b..a060774 100644 --- a/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php +++ b/tests/configuration/preconditions/rtIsSafeModeDisabledTest.php @@ -1,19 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIssafeModeDisabledTest extends PHPUnit_Framework_TestCase { - public function testDisabled() { - $pre = new rtIsSafeModeDisabled(); - $this->assertTrue($pre->check()); - } - public function testgetMessage() { - $pre = new rtIsSafeModeDisabled(); - $this->assertEquals($pre->getMessage('safeModeNotDisabled'), rtText::get('safeModeNotDisabled')); - } - - //Not sure how to check if it is missing? + public function testDisabled() + { + $pre = new rtIsSafeModeDisabled(); + + $this->assertTrue($pre->check()); + } + + public function testgetMessage() + { + $pre = new rtIsSafeModeDisabled(); + + $this->assertEquals($pre->getMessage('safeModeNotDisabled'), rtText::get('safeModeNotDisabled')); + } + + //Not sure how to check if it is missing? } -?> \ No newline at end of file +?> diff --git a/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php b/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php index bfa132d..354ed85 100644 --- a/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php +++ b/tests/configuration/preconditions/rtIsTestFileSpecifiedTest.php @@ -1,53 +1,69 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - class rtIsTestFileSpecifiedTest extends PHPUnit_Framework_TestCase - { - public function testClOptionR() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-r', 'some-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testCLOptionL() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l', 'some-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testCLOptionFileName() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'some-test-file')); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testEnvVar() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - $env->setvariable('TEST_PHP_USER','some-file'); - - $pre = new rtIsTestFileSpecified(); - $this->assertTrue($pre->check($clo,$env)); - } - public function testNotSpecified() { - $env = rtEnvironmentVariables::getInstance(); - $clo = new rtCommandLineOptions(); - - $pre = new rtIsTestFileSpecified(); - $this->assertFalse($pre->check($clo,$env)); - } - public function testGetText() { - $pre = new rtIsTestFileSpecified(); - $this->assertEquals($pre->getMessage('missingTestFile'),rtText::get('missingTestFile')); - } - +{ + public function testClOptionR() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-r', 'some-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testCLOptionL( + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l', 'some-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testCLOptionFileName() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'some-test-file')); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testEnvVar() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + $env->setvariable('TEST_PHP_USER', 'some-file'); + + $pre = new rtIsTestFileSpecified(); + + $this->assertTrue($pre->check($clo, $env)); + } + + public function testNotSpecified() + { + $env = rtEnvironmentVariables::getInstance(); + $clo = new rtCommandLineOptions(); + + $pre = new rtIsTestFileSpecified(); + + $this->assertFalse($pre->check($clo, $env)); + } + + public function testGetText() + { + $pre = new rtIsTestFileSpecified(); + + $this->assertEquals($pre->getMessage('missingTestFile'), rtText::get('missingTestFile')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtAddToCommandLineTest.php b/tests/configuration/rtAddToCommandLineTest.php index b773800..ec38a90 100644 --- a/tests/configuration/rtAddToCommandLineTest.php +++ b/tests/configuration/rtAddToCommandLineTest.php @@ -1,21 +1,22 @@ <?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 rtAddToCommandLineTest extends PHPUnit_Framework_TestCase - { - public function testAdd() { - $commandLine = new rtCommandLineOptions(); - $commandLine->parse(array('run-tests.php', '-n')); - - $env = rtEnvironmentVariables::getInstance(); - $env->setVariable('TEST_PHP_ARGS', '-p a-php-executable'); - - $commandLineAdd = new rtAddToCommandLine(); - $commandLineAdd->parseAdditionalOptions($commandLine, $env); - - $this->assertTrue($commandLine->hasOption('p')); +class rtAddToCommandLineTest extends PHPUnit_Framework_TestCase +{ + public function testAdd() + { + $commandLine = new rtCommandLineOptions(); + $commandLine->parse(array('run-tests.php', '-n')); + + $env = rtEnvironmentVariables::getInstance(); + $env->setVariable('TEST_PHP_ARGS', '-p a-php-executable'); + + $commandLineAdd = new rtAddToCommandLine(); + $commandLineAdd->parseAdditionalOptions($commandLine, $env); + + $this->assertTrue($commandLine->hasOption('p')); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/rtCommandLineOptionsTest.php b/tests/configuration/rtCommandLineOptionsTest.php index 97c3e92..a173ec9 100644 --- a/tests/configuration/rtCommandLineOptionsTest.php +++ b/tests/configuration/rtCommandLineOptionsTest.php @@ -1,85 +1,101 @@ <?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 rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase +{ + public function testNoOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php')); + $fileArray = $clo->getTestFilename(); - class rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase - { - public function testNoOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php')); - $fileArray = $clo->getTestFilename(); - $this->assertTrue(is_array($fileArray)); + $this->assertTrue(is_array($fileArray)); } - public function testShortOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-n')); - $this->assertTrue($clo->hasOption('n')); + public function testShortOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-n')); + + $this->assertTrue($clo->hasOption('n')); } - public function testLongOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--help')); - $this->assertTrue($clo->hasOption('help')); + public function testLongOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--help')); + + $this->assertTrue($clo->hasOption('help')); } - public function testShortOptionWithArg() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l', 'the-l-arg')); - $this->assertTrue($clo->hasOption('l')); - $this->assertEquals('the-l-arg', $clo->getOption('l')); + public function testShortOptionWithArg() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l', 'the-l-arg')); + + $this->assertTrue($clo->hasOption('l')); + $this->assertEquals('the-l-arg', $clo->getOption('l')); } - public function testLongOptionWithArg() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--html', 'the-html-arg')); - $this->assertTrue($clo->hasOption('html')); - $this->assertEquals('the-html-arg', $clo->getOption('html')); + public function testLongOptionWithArg() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--html', 'the-html-arg')); + + $this->assertTrue($clo->hasOption('html')); + $this->assertEquals('the-html-arg', $clo->getOption('html')); } - public function testNonexistingOption() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php')); - $this->assertFalse($clo->hasOption('nonexisting')); - // test for exception when calling getRunOption('nonexisting')? + public function testNonexistingOption() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php')); + + $this->assertFalse($clo->hasOption('nonexisting')); + // test for exception when calling getRunOption('nonexisting')? } - /** - * @expectedException RuntimeException - */ - public function testMissingShortOptionArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '-l')); - $clo->getOption('l'); + /** + * @expectedException RuntimeException + */ + public function testMissingShortOptionArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '-l')); + $clo->getOption('l'); } - /** - * @expectedException RuntimeException - */ - public function testMissingLongOptionArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', '--html')); - $clo->getOption('html'); + /** + * @expectedException RuntimeException + */ + public function testMissingLongOptionArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', '--html')); + $clo->getOption('html'); } - public function testFileArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'the-filename')); - $fileArray = $clo->getTestFilename(); - $this->assertEquals('the-filename', $fileArray[0]); + public function testFileArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'the-filename')); + $fileArray = $clo->getTestFilename(); + + $this->assertEquals('the-filename', $fileArray[0]); } - public function testManyFileArgument() { - $clo = new rtCommandLineOptions(); - $clo->parse(array('run-tests.php', 'the-filename1', 'the-filename2')); - $fileArray = $clo->getTestFilename(); - $this->assertEquals('the-filename2', $fileArray[1]); + public function testManyFileArgument() + { + $clo = new rtCommandLineOptions(); + $clo->parse(array('run-tests.php', 'the-filename1', 'the-filename2')); + $fileArray = $clo->getTestFilename(); + + $this->assertEquals('the-filename2', $fileArray[1]); } // a nasty case is a filename starting with - or -- // the filename should be quoted in that case - } - +} ?> diff --git a/tests/configuration/rtDirectoryListTest.php b/tests/configuration/rtDirectoryListTest.php index f7df000..717a9b4 100644 --- a/tests/configuration/rtDirectoryListTest.php +++ b/tests/configuration/rtDirectoryListTest.php @@ -1,50 +1,48 @@ <?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 rtDirectoryListTestTest extends PHPUnit_Framework_TestCase - { - - public function setUp() { - $tmpDir = sys_get_temp_dir(). "/top"; - mkdir ($tmpDir); - mkdir ($tmpDir. "/a"); - mkdir ($tmpDir. "/b"); - mkdir ($tmpDir. "/c"); - file_put_contents($tmpDir. "/c/afile", "hello"); - mkdir ($tmpDir. "/c/d"); +class rtDirectoryListTestTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $tmpDir = sys_get_temp_dir(). "/top"; + mkdir ($tmpDir); + mkdir ($tmpDir. "/a"); + mkdir ($tmpDir. "/b"); + mkdir ($tmpDir. "/c"); + file_put_contents($tmpDir. "/c/afile", "hello"); + mkdir ($tmpDir. "/c/d"); } - - - public function tearDown() { - $tmpDir = sys_get_temp_dir(). "/top"; - rmdir ($tmpDir. "/a"); - rmdir ($tmpDir. "/b"); - - unlink ($tmpDir. "/c/afile"); - rmdir ($tmpDir. "/c/d"); - rmdir ($tmpDir. "/c"); - rmdir ($tmpDir); + + public function tearDown() + { + $tmpDir = sys_get_temp_dir(). "/top"; + rmdir ($tmpDir. "/a"); + rmdir ($tmpDir. "/b"); + + unlink ($tmpDir. "/c/afile"); + rmdir ($tmpDir. "/c/d"); + rmdir ($tmpDir. "/c"); + rmdir ($tmpDir); } - - public function testNames() { - $directoryList = new rtDirectoryList(); - $top = sys_get_temp_dir(). "/top"; - $list = $directoryList->getSubDirectoryPaths($top); - $this->assertEquals(true, in_array($top . "/a", $list)); - $this->assertEquals(true, in_array($top . "/c/d", $list)); + public function testNames() + { + $directoryList = new rtDirectoryList(); + $top = sys_get_temp_dir(). "/top"; + $list = $directoryList->getSubDirectoryPaths($top); + $this->assertEquals(true, in_array($top . "/a", $list)); + $this->assertEquals(true, in_array($top . "/c/d", $list)); } - - - public function testList() { - $directoryList = new rtDirectoryList(); - $top = sys_get_temp_dir(). "/top"; - $list = $directoryList->getSubDirectoryPaths($top); - $this->assertEquals(5, count($list)); - + + public function testList() + { + $directoryList = new rtDirectoryList(); + $top = sys_get_temp_dir(). "/top"; + $list = $directoryList->getSubDirectoryPaths($top); + $this->assertEquals(5, count($list)); } - - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/rtEnvironmentVariablesTest.php b/tests/configuration/rtEnvironmentVariablesTest.php index b535935..e825758 100644 --- a/tests/configuration/rtEnvironmentVariablesTest.php +++ b/tests/configuration/rtEnvironmentVariablesTest.php @@ -1,53 +1,56 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; - -class rtEnvironmentVariablesTest extends PHPUnit_Framework_TestCase { - - public function setUp() { - putenv('TEST_PHP_EXECUTABLE'); - putenv('TEST_PHP_CGI_EXECUTABLE'); - putenv('TEST_PHP_ARGS'); - putenv('TEST_PHP_SRCDIR'); - putenv('TEST_PHP_LOG_FORMAT'); - putenv('TEST_PHP_DETAILED'); - putenv('TEST_PHP_USER'); - putenv('TEST_PHP_PARALLEL'); - putenv('NO_INTERACTION'); - putenv('PHP_AUTOCONF'); - putenv('TEST_PHP_ARGS'); - putenv('REPORT_EXIT_STATUS'); - putenv('TEST_PHP_ERROR_STYLE'); - putenv('NO_PHPTEST_SUMMARY'); - putenv('SystemRoot'); - - } - - - public function testGetVariable() { - putenv('TEST_PHP_EXECUTABLE=some-executable'); - $ev = rtEnvironmentVariables::getInstance(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('some-executable', $ev->getVariable('TEST_PHP_EXECUTABLE')); - } - - public function testAdaptUnix() { - putenv('TEST_PHP_PARALLEL=a-parallel-run'); - $ev = rtEnvironmentVariables::getInstance(); - $ev->adaptEnvironment(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('a-parallel-run', $ev->getVariable('TEST_PHP_PARALLEL')); - } +class rtEnvironmentVariablesTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + putenv('TEST_PHP_EXECUTABLE'); + putenv('TEST_PHP_CGI_EXECUTABLE'); + putenv('TEST_PHP_ARGS'); + putenv('TEST_PHP_SRCDIR'); + putenv('TEST_PHP_LOG_FORMAT'); + putenv('TEST_PHP_DETAILED'); + putenv('TEST_PHP_USER'); + putenv('TEST_PHP_PARALLEL'); + putenv('NO_INTERACTION'); + putenv('PHP_AUTOCONF'); + putenv('TEST_PHP_ARGS'); + putenv('REPORT_EXIT_STATUS'); + putenv('TEST_PHP_ERROR_STYLE'); + putenv('NO_PHPTEST_SUMMARY'); + putenv('SystemRoot'); + } + + public function testGetVariable() + { + putenv('TEST_PHP_EXECUTABLE=some-executable'); + $ev = rtEnvironmentVariables::getInstance(); + $ev->getUserSuppliedVariables(); + + $this->assertEquals('some-executable', $ev->getVariable('TEST_PHP_EXECUTABLE')); + } + + public function testAdaptUnix() + { + putenv('TEST_PHP_PARALLEL=a-parallel-run'); + $ev = rtEnvironmentVariables::getInstance(); + $ev->adaptEnvironment(); + $ev->getUserSuppliedVariables(); + + $this->assertEquals('a-parallel-run', $ev->getVariable('TEST_PHP_PARALLEL')); + } + + public function testAdaptWin() + { + putenv('SystemRoot=some-windows-thing'); + $ev = rtEnvironmentVariables::getInstance('Windows'); + $ev->adaptEnvironment(); + $ev->getUserSuppliedVariables(); - public function testAdaptWin() { - putenv('SystemRoot=some-windows-thing'); - $ev = rtEnvironmentVariables::getInstance('Windows'); - $ev->adaptEnvironment(); - $ev->getUserSuppliedVariables(); - $this->assertEquals('some-windows-thing', $ev->getVariable('SystemRoot')); - } - - + $this->assertEquals('some-windows-thing', $ev->getVariable('SystemRoot')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtIniAsCommandLineArgsTest.php b/tests/configuration/rtIniAsCommandLineArgsTest.php index 8f3fd73..4a37987 100644 --- a/tests/configuration/rtIniAsCommandLineArgsTest.php +++ b/tests/configuration/rtIniAsCommandLineArgsTest.php @@ -5,55 +5,63 @@ require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; class rtIniAsCommandLineArgsTest extends PHPUnit_Framework_TestCase { - public function testPreSet() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $last49 = addslashes(substr($iniSet->getBasePhpDArgs(), -49)); - $this->assertEquals($last49, '-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"'); - } - - public function testAddFromArray() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('f=g'), $iniSet->getBasePhpDArgs()); - $last38= addslashes(substr($addStr, -38)); - $this->assertEquals($last38, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"f=g\"'); - } - - public function testAddFromArray2() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('a='), $iniSet->getBasePhpDArgs()); - $last37= addslashes(substr($addStr, -37)); - $this->assertEquals($last37, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"a=\"'); - } - - public function testExtraSpaces() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('a = f'), $iniSet->getBasePhpDArgs()); - $last37= addslashes(substr($addStr, -37)); - $this->assertEquals($last37, 'r_mode=U_INVALID_SUBSTITUTE\" -d \"a=f\"'); - } - - /** - * @expectedException rtUnknownIniSettingException - */ - public function testInvalidArg() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af'), $iniSet->getBasePhpDArgs()); - } - - /** - * @expectedException rtUnknownIniSettingException - */ - public function testInvalidArg2() { - $iniSet = new rtIniAsCommandLineArgs(); - $iniSet->setBase(); - $addStr = $iniSet->settingsToArguments(array('af=be=blah'), $iniSet->getBasePhpDArgs()); - } -} -?> + public function testPreSet() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $last49 = addslashes(substr($iniSet->getBasePhpDArgs(), -49)); + + $this->assertEquals($last49, '-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"'); + } + + public function testAddFromArray() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('f=g'), $iniSet->getBasePhpDArgs()); + $last38= addslashes(substr($addStr, -38)); + + $this->assertEquals($last38, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"f=g\"'); + } + + public function testAddFromArray2() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('a='), $iniSet->getBasePhpDArgs()); + $last37= addslashes(substr($addStr, -37)); + $this->assertEquals($last37, 'or_mode=U_INVALID_SUBSTITUTE\" -d \"a=\"'); + } + public function testExtraSpaces() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('a = f'), $iniSet->getBasePhpDArgs()); + $last37= addslashes(substr($addStr, -37)); + + $this->assertEquals($last37, 'r_mode=U_INVALID_SUBSTITUTE\" -d \"a=f\"'); + } + + /** + * @expectedException rtUnknownIniSettingException + */ + public function testInvalidArg() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('af'), $iniSet->getBasePhpDArgs()); + } + + /** + * @expectedException rtUnknownIniSettingException + */ + public function testInvalidArg2() + { + $iniSet = new rtIniAsCommandLineArgs(); + $iniSet->setBase(); + $addStr = $iniSet->settingsToArguments(array('af=be=blah'), $iniSet->getBasePhpDArgs()); + } +} +?> diff --git a/tests/configuration/rtPreconditionListTest.php b/tests/configuration/rtPreconditionListTest.php index 59b98a0..6c7f43e 100644 --- a/tests/configuration/rtPreconditionListTest.php +++ b/tests/configuration/rtPreconditionListTest.php @@ -1,32 +1,36 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtPreCondtionListTest extends PHPUnit_Framework_TestCase +{ + protected $clo; + protected $env; + protected $ge; + + public function setUp() + { + $this->clo = new rtCommandLineOptions(); + $this->clo->parse(array('run-tests.php', '-p', 'some-php-exe', 'a-test.phpt')); + + $this->env = rtEnvironmentVariables::getInstance(); + $this->env->getUserSuppliedVariables(); + } + + public function testCheck() + { + $sl = rtPreConditionList::getInstance(); -class rtPreCondtionListTest extends PHPUnit_Framework_TestCase { - - protected $clo; - protected $env; - protected $ge; - - public function setUp() { - $this->clo = new rtCommandLineOptions(); - $this->clo->parse(array('run-tests.php', '-p', 'some-php-exe', 'a-test.phpt')); - - $this->env = rtEnvironmentVariables::getInstance(); - $this->env->getUserSuppliedVariables(); + $this->assertTrue($sl->check($this->clo, $this->env)); + } - } - - public function testCheck() { - $sl = rtPreConditionList::getInstance(); - $this->assertTrue($sl->check($this->clo, $this->env)); - } - - public function testUnix() { - $sl = rtPreConditionList::getInstance(); - $sl->adaptList(); - $this->assertTrue($sl->hasPreCondition('rtIfParallelHasPcntl')); - } + public function testUnix() + { + $sl = rtPreConditionList::getInstance(); + $sl->adaptList(); + + $this->assertTrue($sl->hasPreCondition('rtIfParallelHasPcntl')); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/rtRuntestsConfigurationTest.php b/tests/configuration/rtRuntestsConfigurationTest.php index d065ae4..b8f0fc6 100644 --- a/tests/configuration/rtRuntestsConfigurationTest.php +++ b/tests/configuration/rtRuntestsConfigurationTest.php @@ -1,26 +1,30 @@ <?php + require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; +class rtRuntestsConfigurationTest extends PHPUnit_Framework_TestCase +{ + public function testCreateUnix() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $config->configure(); + + $testFiles = $config->getSetting('TestFiles'); - class rtRuntestsConfigurationTest extends PHPUnit_Framework_TestCase { - - public function testCreateUnix() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $config->configure(); - - $testFiles = $config->getSetting('TestFiles'); - $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); - $this->assertEquals('test.phpt', $testFiles[0]); + $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); + $this->assertEquals('test.phpt', $testFiles[0]); } - - public function testCreateWin() { - $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt'),'Windows'); - $config->configure(); - - $testFiles = $config->getSetting('TestFiles'); - $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); - $this->assertEquals('test.phpt', $testFiles[0]); + + public function testCreateWin() + { + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt'),'Windows'); + $config->configure(); + + $testFiles = $config->getSetting('TestFiles'); + + $this->assertEquals('a-php-exe', $config->getSetting('PhpExecutable')); + $this->assertEquals('test.phpt', $testFiles[0]); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtCurrentDirectorySettingTest.php b/tests/configuration/settings/rtCurrentDirectorySettingTest.php index 159ed66..221320a 100644 --- a/tests/configuration/settings/rtCurrentDirectorySettingTest.php +++ b/tests/configuration/settings/rtCurrentDirectorySettingTest.php @@ -1,15 +1,16 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetting() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $dirsetting = new rtCurrentDirectorySetting($configuration); -class rtCurrentDirectorySettingTest extends PHPUnit_Framework_TestCase { - - public function testSetting() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $dirsetting = new rtCurrentDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); - } - + $this->assertEquals(getcwd(), $dirsetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtLogFormatSettingTest.php b/tests/configuration/settings/rtLogFormatSettingTest.php index 810dc0e..e2db2e9 100644 --- a/tests/configuration/settings/rtLogFormatSettingTest.php +++ b/tests/configuration/settings/rtLogFormatSettingTest.php @@ -1,23 +1,24 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtLogFormatSettingTest extends PHPUnit_Framework_TestCase +{ + public function testByEnvironmentSetting() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_LOG_FORMAT', 'some-log-format'); -class rtLogFormatSettingTest extends PHPUnit_Framework_TestCase { - - public function testByEnvironmentSetting() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_LOG_FORMAT', 'some-log-format'); + $logsetting = new rtLogFormatSetting($configuration); - $logsetting = new rtLogFormatSetting($configuration); - $this->assertEquals('SOME-LOG-FORMAT', $logsetting->get()); - } + $this->assertEquals('SOME-LOG-FORMAT', $logsetting->get()); + } - public function testSetLEOD() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $logsetting = new rtLogFormatSetting($configuration); - $this->assertEquals('LEOD', $logsetting->get()); - } + public function testSetLEOD() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $logsetting = new rtLogFormatSetting($configuration); + $this->assertEquals('LEOD', $logsetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php index ef6058e..9bbfd09 100644 --- a/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpCgiExecutableSettingTest.php @@ -1,38 +1,34 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetPhpCgiExecutableEV() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); -class rtPhpCgiExecutableSettingTest extends PHPUnit_Framework_TestCase { - - - - public function testSetPhpCgiExecutableEV() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'a-php-executable'); + $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $cgisetting->get()); + $this->assertEquals('a-php-executable', $cgisetting->get()); + } - } - public function testSetPhpCgiExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); + public function testSetPhpCgiExecutableEVAuto() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE', 'auto'); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); - + $cgisetting = new rtPhpCgiExecutableSetting($configuration); - } + $this->assertEquals('WORKING_DIR/sapi/cgi/php', $cgisetting->get()); + } - public function testSetPhpCgiExecutableNotSet() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - - $cgisetting = new rtPhpCgiExecutableSetting($configuration); - - $this->assertEquals(null, $cgisetting->get()); - - } + public function testSetPhpCgiExecutableNotSet() { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + + $cgisetting = new rtPhpCgiExecutableSetting($configuration); + + $this->assertEquals(null, $cgisetting->get()); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php b/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php index 8ccc89d..6f54aa1 100644 --- a/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php +++ b/tests/configuration/settings/rtPhpCommandLineArgSettingTest.php @@ -1,19 +1,18 @@ <?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 rtCommandLineArgSettingTest extends PHPUnit_Framework_TestCase { - - public function testSet() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); - - $clArgsetting = new rtPhpCommandLineArgSetting($configuration); - - $last49 = addslashes(substr($clArgsetting->get(), -49)); - $this->assertEquals('-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"', $last49); - +class rtCommandLineArgSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); + + $clArgsetting = new rtPhpCommandLineArgSetting($configuration); + $last49 = addslashes(substr($clArgsetting->get(), -49)); + + $this->assertEquals('-d \"unicode.from_error_mode=U_INVALID_SUBSTITUTE\"', $last49); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtPhpExecutableSettingTest.php b/tests/configuration/settings/rtPhpExecutableSettingTest.php index 2ab855f..b6a3c70 100644 --- a/tests/configuration/settings/rtPhpExecutableSettingTest.php +++ b/tests/configuration/settings/rtPhpExecutableSettingTest.php @@ -1,38 +1,37 @@ <?php - require_once 'PHPUnit/Framework.php'; - require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - - - class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase { - - public function testSetPhpExecutable() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); - - $clisetting = new rtPhpExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $clisetting->get()); - + +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; + +class rtPhpExecutableSettingTest extends PHPUnit_Framework_TestCase +{ + public function testSetPhpExecutable() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-executable')); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('a-php-executable', $clisetting->get()); } - - public function testSetPhpExecutableEV() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php')); - $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'a-php-executable'); - - $clisetting = new rtPhpExecutableSetting($configuration); - $this->assertEquals('a-php-executable', $clisetting->get()); - - - + + public function testSetPhpExecutableEV() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'a-php-executable'); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('a-php-executable', $clisetting->get()); } - public function testSetPhpExecutableEVAuto() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); - - - $clisetting = new rtPhpExecutableSetting($configuration); - - $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); - + + public function testSetPhpExecutableEVAuto() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_EXECUTABLE', 'auto'); + + $clisetting = new rtPhpExecutableSetting($configuration); + + $this->assertEquals('WORKING_DIR/sapi/cli/php', $clisetting->get()); } - } -?> \ No newline at end of file +} +?> diff --git a/tests/configuration/settings/rtTestDirectorySettingTest.php b/tests/configuration/settings/rtTestDirectorySettingTest.php index be7c5fd..c8bb64d 100644 --- a/tests/configuration/settings/rtTestDirectorySettingTest.php +++ b/tests/configuration/settings/rtTestDirectorySettingTest.php @@ -1,28 +1,28 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; - -class rtTestDirectorySettingsTest extends PHPUnit_Framework_TestCase { - - private $d1; - private $d2; - - public function setUp() { - $this->d1 = sys_get_temp_dir(); - $this->d2 = sys_get_temp_dir(); - } - - public function testSet() { - - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', $this->d1, $this->d2)); - $testdirsetting = new rtTestDirectorySetting($configuration); - - $dirlist = $testdirsetting->get(); - - $this->assertEquals($dirlist[0], $this->d1); - $this->assertEquals($dirlist[1], $this->d2); - - } +class rtTestDirectorySettingsTest extends PHPUnit_Framework_TestCase +{ + private $d1; + private $d2; + + public function setUp() + { + $this->d1 = sys_get_temp_dir(); + $this->d2 = sys_get_temp_dir(); + } + + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', $this->d1, $this->d2)); + $testdirsetting = new rtTestDirectorySetting($configuration); + + $dirlist = $testdirsetting->get(); + + $this->assertEquals($dirlist[0], $this->d1); + $this->assertEquals($dirlist[1], $this->d2); + } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtTestFileSettingTest.php b/tests/configuration/settings/rtTestFileSettingTest.php index 8713996..8ceb4b9 100644 --- a/tests/configuration/settings/rtTestFileSettingTest.php +++ b/tests/configuration/settings/rtTestFileSettingTest.php @@ -3,59 +3,64 @@ require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; -class rtTestFileSettingTest extends PHPUnit_Framework_TestCase { - - private $f1; - private $f2; - private $testnames = array( - '/a.phpt', - '/b.phpt', - '/c.phpt', - ); - - public function setUp() { - $this->f1 = sys_get_temp_dir()."/file1"; - $fh = fopen($this->f1, 'w'); - foreach($this->testnames as $line) { - fwrite($fh, sys_get_temp_dir().$line."\n"); +class rtTestFileSettingTest extends PHPUnit_Framework_TestCase +{ + private $f1; + private $f2; + private $testnames = array( + '/a.phpt', + '/b.phpt', + '/c.phpt', + ); + + public function setUp() + { + $this->f1 = sys_get_temp_dir() . "/file1"; + $fh = fopen($this->f1, 'w'); + + foreach($this->testnames as $line) { + fwrite($fh, sys_get_temp_dir() . $line . "\n"); + } + + fclose($fh); + } + + public function tearDown() + { + unlink($this->f1); + } + + public function testSetFileList() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'the-first-file.phpt', 'the-second-file.phpt' )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], 'the-first-file.phpt'); + $this->assertEquals($filelist[1], 'the-second-file.phpt'); + } + + public function testSetLOption() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-l', $this->f1 )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], sys_get_temp_dir() . '/a.phpt'); + $this->assertEquals($filelist[1], sys_get_temp_dir() . '/b.phpt'); + } + + public function testSetROption() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-r', $this->f1 )); + $testfilesetting = new rtTestFileSetting($configuration); + + $filelist = $testfilesetting->get(); + + $this->assertEquals($filelist[0], sys_get_temp_dir() . '/a.phpt'); + $this->assertEquals($filelist[1], sys_get_temp_dir() . '/b.phpt'); } - fclose($fh); - } - - public function tearDown() { - unlink($this->f1); - } - - public function testSetFileList() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'the-first-file.phpt', 'the-second-file.phpt' )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], 'the-first-file.phpt'); - $this->assertEquals($filelist[1], 'the-second-file.phpt'); - - } - - public function testSetLOption() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-l', $this->f1 )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], sys_get_temp_dir().'/a.phpt'); - $this->assertEquals($filelist[1], sys_get_temp_dir().'/b.phpt'); - - } - public function testSetROption() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', '-r', $this->f1 )); - $testfilesetting = new rtTestFileSetting($configuration); - - $filelist = $testfilesetting->get(); - - $this->assertEquals($filelist[0], sys_get_temp_dir().'/a.phpt'); - $this->assertEquals($filelist[1], sys_get_temp_dir().'/b.phpt'); - - } } -?> \ No newline at end of file +?> diff --git a/tests/configuration/settings/rtWorkingDirectorySettingTest.php b/tests/configuration/settings/rtWorkingDirectorySettingTest.php index 4f84b62..8731431 100644 --- a/tests/configuration/settings/rtWorkingDirectorySettingTest.php +++ b/tests/configuration/settings/rtWorkingDirectorySettingTest.php @@ -1,24 +1,25 @@ <?php + require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +class rtWorkingDirectorySettingTest extends PHPUnit_Framework_TestCase +{ + public function testSet() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $dirsetting = new rtWorkingDirectorySetting($configuration); + $this->assertEquals(getcwd(), $dirsetting->get()); + } -class rtWorkingDirectorySettingTest extends PHPUnit_Framework_TestCase { - - public function testSet() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $dirsetting = new rtWorkingDirectorySetting($configuration); - $this->assertEquals(getcwd(), $dirsetting->get()); - } - - public function testSetFromEnv() { - $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); - $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', 'the-source-dir'); - $dirsetting = new rtWorkingDirectorySetting($configuration); - - $this->assertEquals('the-source-dir', $dirsetting->get()); - } + public function testSetFromEnv() + { + $configuration = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', 'a-php-exe', 'test.phpt')); + $configuration->setEnvironmentVariable('TEST_PHP_SRCDIR', 'the-source-dir'); + $dirsetting = new rtWorkingDirectorySetting($configuration); + $this->assertEquals('the-source-dir', $dirsetting->get()); + } } -?> \ No newline at end of file +?>