修正单元测试

This commit is contained in:
thinkphp
2016-03-21 13:55:06 +08:00
parent 8e9fc3d463
commit 27f3127fbb
2 changed files with 1 additions and 33 deletions

View File

@@ -89,13 +89,11 @@ class Validate
* @access public
* @param array $rules 验证规则
* @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->message = array_merge($this->message, $message);
$this->config = array_merge($this->config, $config);
}
/**
@@ -182,23 +180,6 @@ class Validate
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

View File

@@ -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()
{
$rule = [