com phpruntests: Switched remaining exceptions to rtException.: src/configuration/rtCommandLineOptions.php
src/configuration/rtIniAsCommandLineArgs.php src/configuration/rtPreConditionList.php src/rtText.php src/testcase/rtPhpRunner.php
src/testcase/sections/executablesections/rtCleanSection.php src/testcase/sections/executablesections/rtFileSection.php
src/testcase/sections/executablesections/rtSkipIfSection.php src/testcase/sections/rtSection.p

From: Date: Thu, 23 Jul 2009 11:32:38 +0000
Subject: com phpruntests: Switched remaining exceptions to rtException.: src/configuration/rtCommandLineOptions.php
src/configuration/rtIniAsCommandLineArgs.php src/configuration/rtPreConditionList.php src/rtText.php src/testcase/rtPhpRunner.php
src/testcase/sections/executablesections/rtCleanSection.php src/testcase/sections/executablesections/rtFileSection.php
src/testcase/sections/executablesections/rtSkipIfSection.php src/testcase/sections/rtSection.p
Groups: php.qa 
Request: Send a blank email to php-qa+get-66305@lists.php.net to get a copy of this message
Commit: 63111169502750b1b812ef65eec1499895c54ec7 Author: Stefan Priebsch <spriebsch@php.net> Thu, 23 Jul 2009 11:32:38 +0000 Parents: ab8172bd088320a3cf8f04abc8e29019438f173c Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=63111169502750b1b812ef65eec1499895c54ec7 Log: Switched remaining exceptions to rtException. Changed paths: M src/configuration/rtCommandLineOptions.php M src/configuration/rtIniAsCommandLineArgs.php M src/configuration/rtPreConditionList.php M src/rtText.php M src/testcase/rtPhpRunner.php M src/testcase/sections/executablesections/rtCleanSection.php M src/testcase/sections/executablesections/rtFileSection.php M src/testcase/sections/executablesections/rtSkipIfSection.php M src/testcase/sections/rtSection.php M tests/configuration/rtCommandLineOptionsTest.php M tests/configuration/rtIniAsCommandLineArgsTest.php M tests/testcase/sections/rtSectionTest.php

diff --git a/src/configuration/rtCommandLineOptions.php b/src/configuration/rtCommandLineOptions.php index 26d0bb1..081cf39 100644 --- a/src/configuration/rtCommandLineOptions.php +++ b/src/configuration/rtCommandLineOptions.php @@ -156,7 +156,7 @@ class rtCommandLineOptions } if (!in_array($option, array_merge($this->shortOptions, $this->shortOptionsWithArgs, $this->longOptions, $this->longOptionsWithArgs))) { - throw new rtUnknownOptionException('Unknown option ' . $argv[$i]); + throw new rtException('Unknown option ' . $argv[$i]); } if (in_array($option, array_merge($this->shortOptions, $this->longOptions))) { @@ -165,7 +165,7 @@ class rtCommandLineOptions } if (!$this->isValidOptionArg($argv, $i + 1)) { - throw new rtMissingArgumentException('Missing argument for command line option ' . $argv[$i]); + throw new rtException('Missing argument for command line option ' . $argv[$i]); } $i++; diff --git a/src/configuration/rtIniAsCommandLineArgs.php b/src/configuration/rtIniAsCommandLineArgs.php index a44737a..e74160c 100644 --- a/src/configuration/rtIniAsCommandLineArgs.php +++ b/src/configuration/rtIniAsCommandLineArgs.php @@ -68,7 +68,7 @@ class rtIniAsCommandLineArgs $setting = $this->stripSpaces($setting); $args .= " -d \"$setting\""; } else { - throw new rtUnknownIniSettingException("Invalid INI setting $setting"); + throw new rtException("Invalid INI setting $setting"); } } diff --git a/src/configuration/rtPreConditionList.php b/src/configuration/rtPreConditionList.php index be3b73f..e156825 100644 --- a/src/configuration/rtPreConditionList.php +++ b/src/configuration/rtPreConditionList.php @@ -54,7 +54,7 @@ abstract class rtPreConditionList $p = new $preCon; if (!$p->check($config)) { - throw new Exception($p->getMessage()); + throw new rtException($p->getMessage()); } } diff --git a/src/rtText.php b/src/rtText.php index 0fc7400..c2fd80c 100644 --- a/src/rtText.php +++ b/src/rtText.php @@ -29,7 +29,7 @@ class rtText $filename = dirname(__FILE__) . '/texts/' . $name . '.txt'; if (!file_exists($filename)) { - throw new LogicException('The text ' . $name . ' does not exist'); + throw new rtException('The text ' . $name . ' does not exist'); } $text = file_get_contents($filename); diff --git a/src/testcase/rtPhpRunner.php b/src/testcase/rtPhpRunner.php index e7aacb8..31eea7f 100644 --- a/src/testcase/rtPhpRunner.php +++ b/src/testcase/rtPhpRunner.php @@ -49,7 +49,7 @@ class rtPhpRunner ); if (!$proc) { - throw new rtPhpRunnerException('Failed to open process to run PHP code in rtPhpRunner'); + throw new rtException('Failed to open process to run PHP code in rtPhpRunner'); } if (!is_null($this->stdin)) { @@ -67,10 +67,10 @@ class rtPhpRunner $n = @stream_select($r, $w, $e, $this->timeOut); if ($n === false) { - throw new rtPhpRunnerException('Stream select failure in rtPhpRunner'); + throw new rtException('Stream select failure in rtPhpRunner'); } else if ($n === 0) { proc_terminate($proc); - throw new rtPhpRunnerException ('The process running test code has timed out in rtPhpRunner'); + throw new rtException ('The process running test code has timed out in rtPhpRunner'); } else if ($n > 0) { $line = fread($pipes[1], 8192); if (strlen($line) == 0) { @@ -84,7 +84,7 @@ class rtPhpRunner /* check the process status. Note that this will always be FALSE on windows */ $stat = proc_get_status($proc); if ($stat['signaled']) { - throw new rtPhpRunnerException('The process was terminated by uncaught signal number in rtPhpRunners'); + throw new rtException('The process was terminated by uncaught signal number in rtPhpRunners'); } $code = proc_close($proc); diff --git a/src/testcase/sections/executablesections/rtCleanSection.php b/src/testcase/sections/executablesections/rtCleanSection.php index ace4959..89d1e38 100644 --- a/src/testcase/sections/executablesections/rtCleanSection.php +++ b/src/testcase/sections/executablesections/rtCleanSection.php @@ -43,7 +43,7 @@ class rtCleanSection extends rtExecutableSection $testStatus->setMessage('fail_clean','Execution of clean section failed: '.trim($this->output) ); } - } catch (rtPhpRunnerException $e) { + } catch (rtException $e) { $testStatus->setTrue('fail_clean'); $testStatus->setMessage('fail_clean',$e->getMessage); } diff --git a/src/testcase/sections/executablesections/rtFileSection.php b/src/testcase/sections/executablesections/rtFileSection.php index 4d0bb0d..7061e17 100644 --- a/src/testcase/sections/executablesections/rtFileSection.php +++ b/src/testcase/sections/executablesections/rtFileSection.php @@ -68,7 +68,7 @@ class rtFileSection extends rtExecutableSection } - } catch (rtPhpRunnerException $e) { + } catch (rtException $e) { $testStatus->setTrue('fail'); $testStatus->setMessage('fail', $e->getMessage() ); } diff --git a/src/testcase/sections/executablesections/rtSkipIfSection.php b/src/testcase/sections/executablesections/rtSkipIfSection.php index 76e59ea..0b68bbb 100644 --- a/src/testcase/sections/executablesections/rtSkipIfSection.php +++ b/src/testcase/sections/executablesections/rtSkipIfSection.php @@ -60,7 +60,7 @@ class rtSkipIfSection extends rtExecutableSection $testStatus->setMessage('warn', $matches[1]); } } - } catch (rtPhpRunnerException $e) { + } catch (rtException $e) { $testStatus->setTrue('fail_skip'); $testStatus->setMessage('fail_skip', 'Failed to execute skipif section' . $e->getMessage()); } diff --git a/src/testcase/sections/rtSection.php b/src/testcase/sections/rtSection.php index 5a1bca7..91c9952 100644 --- a/src/testcase/sections/rtSection.php +++ b/src/testcase/sections/rtSection.php @@ -58,7 +58,7 @@ abstract class rtSection public static function getInstance($sectionName, $contents) { if (!isset(self::$sectionMap[$sectionName])) { - throw new RuntimeException('Unknown section type ' . $sectionName); + throw new rtException('Unknown section type ' . $sectionName); } return new rtSection::$sectionMap[$sectionName]($sectionName, $contents); diff --git a/tests/configuration/rtCommandLineOptionsTest.php b/tests/configuration/rtCommandLineOptionsTest.php index a173ec9..854b152 100644 --- a/tests/configuration/rtCommandLineOptionsTest.php +++ b/tests/configuration/rtCommandLineOptionsTest.php @@ -58,7 +58,7 @@ class rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase } /** - * @expectedException RuntimeException + * @expectedException rtException */ public function testMissingShortOptionArgument() { @@ -68,7 +68,7 @@ class rtCommandLineOptionsTest extends PHPUnit_Framework_TestCase } /** - * @expectedException RuntimeException + * @expectedException rtException */ public function testMissingLongOptionArgument() { diff --git a/tests/configuration/rtIniAsCommandLineArgsTest.php b/tests/configuration/rtIniAsCommandLineArgsTest.php index fa94840..547d8e7 100644 --- a/tests/configuration/rtIniAsCommandLineArgsTest.php +++ b/tests/configuration/rtIniAsCommandLineArgsTest.php @@ -45,7 +45,7 @@ class rtIniAsCommandLineArgsTest extends PHPUnit_Framework_TestCase } /** - * @expectedException rtUnknownIniSettingException + * @expectedException rtException */ public function testInvalidArg() { diff --git a/tests/testcase/sections/rtSectionTest.php b/tests/testcase/sections/rtSectionTest.php index 68058ae..b2c0648 100644 --- a/tests/testcase/sections/rtSectionTest.php +++ b/tests/testcase/sections/rtSectionTest.php @@ -12,7 +12,7 @@ class rtSectionTest extends PHPUnit_Framework_TestCase } /** - * @expectedException RuntimeException + * @expectedException rtException */ public function testGetInstanceThrowsExceptionOnUnknownSection() {
« previous php.qa (#66305) next »