assert_equal() public static method

assert that $a is equal to $b. Uses == for comparison
public static assert_equal ( mixed $a, mixed $b, string $msg = null )
$a mixed the actual value
$b mixed the expected value
$msg string optional description of assertion
Esempio n. 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();