Force a successful assertion
public static assert_pass ( string $msg = null ) | ||
$msg | string | optional description of assertion |
fu::strict_equal(false, fu::assert_has('bingo', $obj)['result'], "\$obj does not have property 'bingo'"); }); fu::test('FUnit::assert_not_has tests', function () { $arr = array("foo" => true, "bar" => null, "baz" => "bingo"); $obj = new stdClass(); $obj->foo = true; $obj->bar = null; $obj->baz = "bingo"; fu::strict_equal(false, fu::assert_not_has('foo', $arr)['result'], "\$arr has key 'foo'"); fu::strict_equal(false, fu::assert_not_has('bar', $arr)['result'], "\$arr has key 'bar'"); fu::strict_equal(false, fu::assert_not_has('baz', $arr)['result'], "\$arr has key 'baz'"); fu::strict_equal(true, fu::assert_not_has('bingo', $arr)['result'], "\$arr does not have key 'bingo'"); fu::strict_equal(false, fu::assert_not_has('foo', $obj)['result'], "\$obj has property 'foo'"); fu::strict_equal(false, fu::assert_not_has('bar', $obj)['result'], "\$obj has property 'bar'"); fu::strict_equal(false, fu::assert_not_has('baz', $obj)['result'], "\$obj has property 'baz'"); fu::strict_equal(true, fu::assert_not_has('bingo', $obj)['result'], "\$obj does not have property 'bingo'"); }); fu::test('FUnit::assert_fail tests', function () { fu::strict_equal(false, fu::assert_fail()['result'], "forced fail"); }); fu::test('FUnit::assert_expect_fail tests', function () { fu::strict_equal(false, fu::assert_expect_fail()['result'], "forced expected fail"); }); fu::test('FUnit::assert_pass tests', function () { fu::strict_equal(true, fu::assert_pass()['result'], "forced pass"); }); fu::test('Ensure not including msg param has no side effects', function () { fu::strict_equal(true, fu::assert_equal(1, 1, 'poop')['result']); fu::strict_equal(true, fu::assert_equal(1, 1)['result']); }); fu::run();