Ejemplo n.º 1
0
<?php

/**
 * Проверяем что нет ошибок и возвращаются ожидаемые данные User::get...
 */
use itlife\infra\ext\Ans;
use itlife\user\User;
infra_test(true);
$ans = array();
$data = User::get();
if (!$data || sizeof($data) != 5 || !$data['result'] || !$data['id']) {
    return Ans::err($ans, 'User data get error');
}
return Ans::ret($ans, 'Ok');
Ejemplo n.º 2
0
if (mb_strlen($text) != 1935) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$name = 'test.html';
$text = Mht::get('*files/tests/resources/' . $name);
if (strlen($text) != 1073) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$data = Xlsx::init('*files/tests/resources/test.xlsx');
if (!$data) {
    return Ans::err($ans, 'Cant read test.xlsx');
}
$data = Xlsx::init('*files/tests/resources/test.csv');
if (!$data) {
    return Ans::err($ans, 'Cant read test.csv');
}
if (sizeof($data['childs']) != 1) {
    return Ans::err($ans, 'Cant read test.csv ' . sizeof($data['childs']));
}
$num = ini_get('mbstring.func_overload');
if ($num != 0) {
    $ans['class'] = 'bg-warning';
    return Ans::err($ans, 'mbstring.func_overload should be 0, not ' . $num);
} else {
    $data = Xlsx::get('*files/tests/resources/test.xls');
    if (sizeof($data['childs'][0]['data']) != 30) {
        return Ans::err($ans, 'Cant read test.xls ' . sizeof($data['childs'][0]['data']));
    }
}
return Ans::ret($ans, 'tpl, mht, docx, xls, xlsx read ok!');