assert_not_strict_equal() public static method

assert that $a is strictly not equal to $b. Uses !== for comparison
public static assert_not_strict_equal ( mixed $a, mixed $b, string $msg = null )
$a mixed the actual value
$b mixed the expected value
$msg string optional description of assertion
Ejemplo n.º 1
0
    fu::strict_equal(false, fu::assert_strict_equal(null, 0)['result'], "null and 0 are not strict equal");
    fu::strict_equal(false, fu::assert_strict_equal(false, null)['result'], "false and null are not strict equal");
    fu::strict_equal(false, fu::assert_strict_equal(array(), null)['result'], "array() and null are not strict equal");
});
fu::test('FUnit::assert_not_strict_equal tests', function () {
    fu::strict_equal(false, fu::assert_not_strict_equal(1, 1)['result'], "1 and 1 are strict equal");
    fu::strict_equal(false, fu::assert_not_strict_equal("a", "a")['result'], "'a' and 'a' are strict equal");
    $a = new StdClass();
    $b = $a;
    fu::strict_equal(false, fu::assert_not_strict_equal($a, $b)['result'], "\$a and \$b refer to same object, so strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(new stdClass(), new stdClass())['result'], "new stdClass and new stdClass are not strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(1, "1")['result'], "1 and '1' are not strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(1, true)['result'], "1 and true are not strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(null, 0)['result'], "null and 0 are not strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(false, null)['result'], "false and null are not strict equal");
    fu::strict_equal(true, fu::assert_not_strict_equal(array(), null)['result'], "array() and null are not strict equal");
});
fu::test('FUnit::assert_throws tests', function () {
    $callback = function () {
        throw new RuntimeException();
    };
    $rs = fu::assert_throws($callback, 'RuntimeException')['result'];
    fu::strict_equal(true, $rs, "callback threw correct exception type");
    $callback = function ($foo) {
        throw new RuntimeException($foo);
    };
    $rs = fu::assert_throws($callback, array('bar'), 'LogicException')['result'];
    fu::strict_equal(false, $rs, "callback didn't throw correct exception type");
});
fu::test('FUnit::assert_has tests', function () {
    $arr = array("foo" => true, "bar" => null, "baz" => "bingo");