Browse Source

#8995, #8996 - added unit test, changelog line

tags/2.0.7
SilverFire - Dmitry Naumenko 9 years ago
parent
commit
2be8a716b1
  1. 1
      framework/CHANGELOG.md
  2. 10
      tests/framework/validators/FileValidatorTest.php

1
framework/CHANGELOG.md

@ -53,6 +53,7 @@ Yii Framework 2 Change Log
- Enh #8329: Added support of options for `message` console command (vchenin) - Enh #8329: Added support of options for `message` console command (vchenin)
- Enh #8613: `yii\widgets\FragmentCache` will not store empty content anymore which fixes some problems related to `yii\filters\PageCache` (kidol) - Enh #8613: `yii\widgets\FragmentCache` will not store empty content anymore which fixes some problems related to `yii\filters\PageCache` (kidol)
- Enh #8649: Added total applied migrations to final report (vernik91) - Enh #8649: Added total applied migrations to final report (vernik91)
- Enh #8995: `yii\validators\FileValidator::maxFiles` can be set to `0` to allow unlimited count of files (PowerGamer1, silverfire)
- Enh #9282: Improved JSON error handling to support PHP 5.5 error codes (freezy-sk) - Enh #9282: Improved JSON error handling to support PHP 5.5 error codes (freezy-sk)
- Enh #9337: Added `yii\db\ColumnSchemaBuilder::defaultExpression()` to support DB Expression as default value (kotchuprik) - Enh #9337: Added `yii\db\ColumnSchemaBuilder::defaultExpression()` to support DB Expression as default value (kotchuprik)
- Enh #9465: ./yii migrate/create now generates code based on migration name and --fields (pana1990) - Enh #9465: ./yii migrate/create now generates code based on migration name and --fields (pana1990)

10
tests/framework/validators/FileValidatorTest.php

@ -137,6 +137,12 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_files'); $val->validateAttribute($m, 'attr_files');
$this->assertTrue($m->hasErrors()); $this->assertTrue($m->hasErrors());
$this->assertTrue(stripos(current($m->getErrors('attr_files')), 'you can upload at most') !== false); $this->assertTrue(stripos(current($m->getErrors('attr_files')), 'you can upload at most') !== false);
$val->maxFiles = 0;
$m->clearErrors();
$val->validateAttribute($m, 'attr_files');
$this->assertFalse($m->hasErrors());
$m = FakedValidationModel::createWithAttributes( $m = FakedValidationModel::createWithAttributes(
[ [
'attr_images' => $this->createTestFiles( 'attr_images' => $this->createTestFiles(
@ -152,8 +158,8 @@ class FileValidatorTest extends TestCase
'type' => 'image/png' 'type' => 'image/png'
], ],
[ [
'name' => 'text.txt', 'name' => 'text.txt',
'size' => 1024 'size' => 1024
], ],
] ]
) )

Loading…
Cancel
Save