aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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