*/ class PradoUnitTestCase extends UnitTestCase { /** * Tests whether the given code results in an appropriate exception being raised. * @param string the PHP code to execute. must end with a semi-colon. * @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"); } } } ?>