assert_expect_fail() 공개 정적인 메소드

Fail an assertion in an expected way
또한 보기: FUnit::fail()
public static assert_expect_fail ( string $msg = null )
$msg string optional description of assertion
예제 #1
0
    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();