/** * This one's a bit dubious - it tests that an assertion made by the supplied * lambda fails. It primarily exists for self-testing the ztest library, and * using it causes the displayed assertion stats to be incorrect. */ function assert_fails($lambda, $msg = '') { $caught = false; try { $lambda(); } catch (ztest\AssertionFailed $e) { $caught = true; pass(); } if (!$caught) { Spec::assert_fail(); //throw new ztest\AssertionFailed($msg); } }