summaryrefslogtreecommitdiff
path: root/tests/UnitTests/framework/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/UnitTests/framework/common.php')
-rw-r--r--tests/UnitTests/framework/common.php20
1 files changed, 4 insertions, 16 deletions
diff --git a/tests/UnitTests/framework/common.php b/tests/UnitTests/framework/common.php
index bcff7a89..80514875 100644
--- a/tests/UnitTests/framework/common.php
+++ b/tests/UnitTests/framework/common.php
@@ -40,23 +40,11 @@ class PradoUnitTestCase extends UnitTestCase {
* @param string the type of exception that should be raised.
* @return boolean true
*/
- public function assertException(string $code, string $exception) {
- $pass = false;
- $code = "
-try {
- $code
-} catch ($exception \$e) {
- \$pass = true;
-}";
- eval($code);
- if ($pass) {
- $this->pass();
- } else {
- $this->fail("Code did not produce correct exception (wanted $exception, got something else");
- }
+ public function assertException(string $code, string $exceptionType) {
+ $ex = null;
+ eval("try { $code } catch ($exceptionType \$e) { \$ex = \$e; }");
+ $this->assertIsA($ex, $exceptionType);
}
}
-
-
?> \ No newline at end of file