Commit baa78bc2 by Qiang Xue

fixed test break.

parent 2629074b
......@@ -170,9 +170,19 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_files');
$this->assertFalse($m->hasErrors());
$val->validateAttribute($m, 'attr_files_empty');
$this->assertFalse($m->hasErrors('attr_files_empty'));
$m = $this->createModelForAttributeTest();
// single File with skipOnEmpty=false
$val = new FileValidator(['skipOnEmpty' => false]);
$m = $this->createModelForAttributeTest();
$val->validateAttribute($m, 'attr_files');
$this->assertFalse($m->hasErrors());
$val->validateAttribute($m, 'attr_files_empty');
$this->assertTrue($m->hasErrors('attr_files_empty'));
$this->assertSame($val->uploadRequired, current($m->getErrors('attr_files_empty')));
$m = $this->createModelForAttributeTest();
// too big
$val = new FileValidator(['maxSize' => 128]);
$val->validateAttribute($m, 'attr_files');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment