mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
修正单元测试
This commit is contained in:
@@ -89,13 +89,11 @@ class Validate
|
|||||||
* @access public
|
* @access public
|
||||||
* @param array $rules 验证规则
|
* @param array $rules 验证规则
|
||||||
* @param array $message 验证提示信息
|
* @param array $message 验证提示信息
|
||||||
* @param array $config 验证参数
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $rules = [], $message = [], $config = [])
|
public function __construct(array $rules = [], $message = [])
|
||||||
{
|
{
|
||||||
$this->rule = array_merge($this->rule, $rules);
|
$this->rule = array_merge($this->rule, $rules);
|
||||||
$this->message = array_merge($this->message, $message);
|
$this->message = array_merge($this->message, $message);
|
||||||
$this->config = array_merge($this->config, $config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,23 +180,6 @@ class Validate
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 传入验证参数
|
|
||||||
* @access public
|
|
||||||
* @param string|array $name 参数名或者数组
|
|
||||||
* @param mixed $value 参数值
|
|
||||||
* @return Validate
|
|
||||||
*/
|
|
||||||
public function config($name, $value = null)
|
|
||||||
{
|
|
||||||
if (is_array($name)) {
|
|
||||||
$this->config = array_merge($this->config, $name);
|
|
||||||
} else {
|
|
||||||
$this->config[$name] = $value;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置验证场景
|
* 设置验证场景
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
@@ -104,19 +104,6 @@ class validateTest extends \PHPUnit_Framework_TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConfig()
|
|
||||||
{
|
|
||||||
$validate = new Validate();
|
|
||||||
$validate->config('value_validate', ['name', 'age', 'email']);
|
|
||||||
$validate->config([
|
|
||||||
'value_validate' => ['name', 'age', 'email'],
|
|
||||||
'exists_validate' => ['zip'],
|
|
||||||
'scene' => [
|
|
||||||
'edit' => ['name', 'age', 'email'],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testMake()
|
public function testMake()
|
||||||
{
|
{
|
||||||
$rule = [
|
$rule = [
|
||||||
|
|||||||
Reference in New Issue
Block a user