Commit 35f88232 by Qiang Xue

fixed test break.

parent d8acd3a2
...@@ -183,27 +183,13 @@ class FileValidatorTest extends TestCase ...@@ -183,27 +183,13 @@ class FileValidatorTest extends TestCase
$val = new FileValidator(['minSize' => 2048]); $val = new FileValidator(['minSize' => 2048]);
$val->validateAttribute($m, 'attr_files'); $val->validateAttribute($m, 'attr_files');
$this->assertTrue($m->hasErrors('attr_files')); $this->assertTrue($m->hasErrors('attr_files'));
$this->assertTrue( $this->assertTrue(stripos(current($m->getErrors('attr_files')), 'too small') !== false);
stripos(
current($m->getErrors('attr_files')),
str_ireplace(['{file}', '{limit}'], [$m->attr_files->name, 2048], $val->tooSmall)
) !== false
);
// UPLOAD_ERR_INI_SIZE/UPLOAD_ERR_FORM_SIZE // UPLOAD_ERR_INI_SIZE/UPLOAD_ERR_FORM_SIZE
$m = $this->createModelForAttributeTest(); $m = $this->createModelForAttributeTest();
$val = new FileValidator(); $val = new FileValidator();
$val->validateAttribute($m, 'attr_err_ini'); $val->validateAttribute($m, 'attr_err_ini');
$this->assertTrue($m->hasErrors('attr_err_ini')); $this->assertTrue($m->hasErrors('attr_err_ini'));
$this->assertTrue( $this->assertTrue(stripos(current($m->getErrors('attr_files')), 'too big') !== false);
stripos(
current($m->getErrors('attr_err_ini')),
str_ireplace(
['{file}', '{limit}'],
[$m->attr_err_ini->name, $val->getSizeLimit()],
$val->tooBig
)
) !== false
);
// UPLOAD_ERR_PARTIAL // UPLOAD_ERR_PARTIAL
$m = $this->createModelForAttributeTest(); $m = $this->createModelForAttributeTest();
$val = new FileValidator(); $val = new FileValidator();
......
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