添加lang类单元测试

This commit is contained in:
thinkphp
2016-02-28 13:41:16 +08:00
parent 8d79e07dc5
commit 58eebe7763
5 changed files with 73 additions and 8 deletions

View File

@@ -153,8 +153,7 @@ class App
{
$args = [];
// 判断数组类型 数字数组时按顺序绑定参数
$keys = array_keys($vars);
$type = array_keys($keys) === $keys ? 1 : 0;
$type = key($vars) === 0 ? 1 : 0;
if ($reflect->getNumberOfParameters() > 0) {
$params = $reflect->getParameters();
foreach ($params as $param) {

View File

@@ -94,7 +94,7 @@ class Lang
}
$key = strtolower($name);
$value = isset(self::$lang[$range][$key]) ? self::$lang[$range][$key] : $name;
// 变量解析
if (!empty($vars) && is_array($vars)) {
/**
@@ -104,7 +104,7 @@ class Lang
*/
if (key($vars) === 0) {
// 数字索引解析
array_unshift($vars, $name);
array_unshift($vars, $value);
$value = call_user_func_array('sprintf', $vars);
} else {
// 关联索引解析
@@ -114,8 +114,7 @@ class Lang
}
$value = str_replace($replace, $vars, $value);
}
}
return $value;
}

View File

@@ -536,8 +536,7 @@ class Model
// 根据主键查询
if (is_array($options)) {
// 判断是否索引数组
$keys = array_keys($options);
if (array_keys($keys) === $keys) {
if (key($options) === 0) {
$where[$pk] = ['in', $options];
} else {
return;