Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
1a3c04e0
Commit
1a3c04e0
authored
Jun 14, 2014
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed tests
parent
42643e37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
FakedValidationModel.php
tests/unit/data/validators/models/FakedValidationModel.php
+2
-2
FileValidatorTest.php
tests/unit/framework/validators/FileValidatorTest.php
+8
-3
No files found.
tests/unit/data/validators/models/FakedValidationModel.php
View file @
1a3c04e0
...
...
@@ -31,8 +31,8 @@ class FakedValidationModel extends Model
return
[
[[
'val_attr_a'
,
'val_attr_b'
],
'required'
,
'on'
=>
'reqTest'
],
[
'val_attr_c'
,
'integer'
],
[
'attr_images'
,
'file'
,
'maxFiles'
=>
3
,
'types'
=>
[
'png'
],
'on'
=>
'validateMultipleFiles'
],
[
'attr_image'
,
'file'
,
'types'
=>
[
'png'
],
'on'
=>
'validateFile'
]
[
'attr_images'
,
'file'
,
'maxFiles'
=>
3
,
'types'
=>
[
'png'
],
'on'
=>
'validateMultipleFiles'
,
'checkTypeAgainstMime'
=>
false
],
[
'attr_image'
,
'file'
,
'types'
=>
[
'png'
],
'on'
=>
'validateFile'
,
'checkTypeAgainstMime'
=>
false
]
];
}
...
...
tests/unit/framework/validators/FileValidatorTest.php
View file @
1a3c04e0
...
...
@@ -102,7 +102,9 @@ class FileValidatorTest extends TestCase
public
function
testValidateAttributeMultiple
()
{
$val
=
new
FileValidator
([
'maxFiles'
=>
2
]);
$val
=
new
FileValidator
([
'maxFiles'
=>
2
,
]);
$m
=
FakedValidationModel
::
createWithAttributes
([
'attr_files'
=>
'path'
]);
$val
->
validateAttribute
(
$m
,
'attr_files'
);
$this
->
assertTrue
(
$m
->
hasErrors
(
'attr_files'
));
...
...
@@ -221,7 +223,7 @@ class FileValidatorTest extends TestCase
continue
;
}
$name
=
isset
(
$param
[
'name'
])
?
$param
[
'name'
]
:
$rndString
();
$tempName
=
\Yii
::
getAlias
(
'@yiiunit/runtime/validators/file/tmp'
)
.
$name
;
$tempName
=
\Yii
::
getAlias
(
'@yiiunit/runtime/validators/file/tmp
/
'
)
.
$name
;
if
(
is_readable
(
$tempName
))
{
$size
=
filesize
(
$tempName
);
}
else
{
...
...
@@ -303,7 +305,10 @@ class FileValidatorTest extends TestCase
public
function
testValidateAttributeType
()
{
$val
=
new
FileValidator
([
'types'
=>
'jpeg, jpg'
]);
$val
=
new
FileValidator
([
'types'
=>
'jpeg, jpg'
,
'checkTypeAgainstMime'
=>
false
,
]);
$m
=
FakedValidationModel
::
createWithAttributes
(
[
'attr_jpg'
=>
$this
->
createTestFiles
([[
'name'
=>
'one.jpeg'
]]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment