aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2008-11-24 00:24:46 +0000
committerNils Adermann <naderman@naderman.de>2008-11-24 00:24:46 +0000
commitbcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0 (patch)
tree5be54201c6363422df74be493d368b4a66d85ae7 /tests/test_framework
parent07e9b83a3de0264916a058b9cf180b91b297604f (diff)
downloadforums-bcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0.tar
forums-bcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0.tar.gz
forums-bcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0.tar.bz2
forums-bcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0.tar.xz
forums-bcfcf9b0483b2b37ed0698f9e943e9a241ccb5d0.zip
- added phpBB test framework which is an extension with some additional
functionality of PHPUnit - first addition: setExpectedTriggerError() if a test expects a call to trigger_error(). git-svn-id: file:///svn/phpbb/trunk@9103 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/framework.php5
-rw-r--r--tests/test_framework/phpbb_test_case.php30
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_framework/framework.php b/tests/test_framework/framework.php
new file mode 100644
index 0000000000..f04c73d4c9
--- /dev/null
+++ b/tests/test_framework/framework.php
@@ -0,0 +1,5 @@
+<?php
+
+require_once 'PHPUnit/Framework.php';
+
+require_once 'test_framework/phpbb_test_case.php'; \ No newline at end of file
diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php
new file mode 100644
index 0000000000..d5fdcf9889
--- /dev/null
+++ b/tests/test_framework/phpbb_test_case.php
@@ -0,0 +1,30 @@
+<?php
+
+class phpbb_test_case extends PHPUnit_Framework_TestCase
+{
+ protected $expectedTriggerError = false;
+
+ public function setExpectedTriggerError($errno, $message = '')
+ {
+ $exceptionName = '';
+ switch ($errno)
+ {
+ case E_NOTICE:
+ case E_STRICT:
+ PHPUnit_Framework_Error_Notice::$enabled = true;
+ $exceptionName = 'PHPUnit_Framework_Error_Notice';
+ break;
+
+ case E_WARNING:
+ PHPUnit_Framework_Error_Warning::$enabled = true;
+ $exceptionName = 'PHPUnit_Framework_Error_Warning';
+ break;
+
+ default:
+ $exceptionName = 'PHPUnit_Framework_Error';
+ break;
+ }
+ $this->expectedTriggerError = true;
+ $this->setExpectedException($exceptionName, (string) $message, $errno);
+ }
+} \ No newline at end of file