Ejemplo n.º 1
0
function kind_of_equal($a, $b)
{
    if (!is_array($a) || !is_array($b)) {
        return $a === $b;
    }
    if (count($a) !== count($b)) {
        return false;
    }
    foreach ($a as $key => $value) {
        if (!isset($b[$key])) {
            return false;
        }
        if (!kind_of_equal($value, $b[$key])) {
            return false;
        }
    }
    return true;
}
Ejemplo n.º 2
0
Archivo: test.php Proyecto: name3/cheng
if (_get('exit')) {
    echo '<script src="static/hide.js"></script>';
    echo '<div class="conclusion pass">All Clear!</div>';
    exit;
}
$all_pass = true;
// case 1 autoload
begin_test();
$id = 101;
$model = new Model($id);
test($model->id, $id, array('name' => 'autoload'));
// case 2 test for kind_of_equal()
begin_test();
$a = array('z' => 3, 'a' => 42);
$b = array('a' => 42, 'z' => 3);
test(kind_of_equal($a, $b), true, array('name' => 'test for kind_of_equal()'));
// case 3 register Customer, user db
begin_test();
$username = '******';
$password = '******';
$realname = '小池';
$phone = '13711231212';
$email = '*****@*****.**';
$info = compact('username', 'password', 'realname', 'phone', 'email');
$customer = Customer::register($info);
test(1, 1, array('name' => 'register Customer, db'));
// case 4 User::check($username, $password)
begin_test();
test(User::check($username, $password), true, array('name' => 'User::check($username, $password)'));
// case 5 Super Admin create Admin, db
begin_test();