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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
32865c7d
Commit
32865c7d
authored
Oct 15, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated FileValidator tests
parent
8c1c3c59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
FileValidatorTest.php
tests/unit/framework/validators/FileValidatorTest.php
+17
-5
No files found.
tests/unit/framework/validators/FileValidatorTest.php
View file @
32865c7d
...
@@ -141,9 +141,21 @@ class FileValidatorTest extends TestCase
...
@@ -141,9 +141,21 @@ class FileValidatorTest extends TestCase
$error
=
isset
(
$param
[
'error'
])
?
$param
[
'error'
]
:
UPLOAD_ERR_OK
;
$error
=
isset
(
$param
[
'error'
])
?
$param
[
'error'
]
:
UPLOAD_ERR_OK
;
if
(
count
(
$params
)
==
1
)
{
if
(
count
(
$params
)
==
1
)
{
$error
=
empty
(
$param
)
?
UPLOAD_ERR_NO_FILE
:
$error
;
$error
=
empty
(
$param
)
?
UPLOAD_ERR_NO_FILE
:
$error
;
return
new
UploadedFile
(
$name
,
$tempName
,
$type
,
$size
,
$error
);
return
new
UploadedFile
(
array
(
'name'
=>
$name
,
'tempName'
=>
$tempName
,
'type'
=>
$type
,
'size'
=>
$size
,
'error'
=>
$error
));
}
}
$files
[]
=
new
UploadedFile
(
$name
,
$tempName
,
$type
,
$size
,
$error
);
$files
[]
=
new
UploadedFile
(
array
(
'name'
=>
$name
,
'tempName'
=>
$tempName
,
'type'
=>
$type
,
'size'
=>
$size
,
'error'
=>
$error
));
}
}
return
$files
;
return
$files
;
}
}
...
@@ -166,7 +178,7 @@ class FileValidatorTest extends TestCase
...
@@ -166,7 +178,7 @@ class FileValidatorTest extends TestCase
$this
->
assertTrue
(
$this
->
assertTrue
(
stripos
(
stripos
(
current
(
$m
->
getErrors
(
'attr_files'
)),
current
(
$m
->
getErrors
(
'attr_files'
)),
str_ireplace
(
array
(
'{file}'
,
'{limit}'
),
array
(
$m
->
attr_files
->
getName
()
,
128
),
$val
->
tooBig
)
str_ireplace
(
array
(
'{file}'
,
'{limit}'
),
array
(
$m
->
attr_files
->
name
,
128
),
$val
->
tooBig
)
)
!==
false
)
!==
false
);
);
// to Small
// to Small
...
@@ -177,7 +189,7 @@ class FileValidatorTest extends TestCase
...
@@ -177,7 +189,7 @@ class FileValidatorTest extends TestCase
$this
->
assertTrue
(
$this
->
assertTrue
(
stripos
(
stripos
(
current
(
$m
->
getErrors
(
'attr_files'
)),
current
(
$m
->
getErrors
(
'attr_files'
)),
str_ireplace
(
array
(
'{file}'
,
'{limit}'
),
array
(
$m
->
attr_files
->
getName
()
,
2048
),
$val
->
tooSmall
)
str_ireplace
(
array
(
'{file}'
,
'{limit}'
),
array
(
$m
->
attr_files
->
name
,
2048
),
$val
->
tooSmall
)
)
!==
false
)
!==
false
);
);
// UPLOAD_ERR_INI_SIZE/UPLOAD_ERR_FORM_SIZE
// UPLOAD_ERR_INI_SIZE/UPLOAD_ERR_FORM_SIZE
...
@@ -190,7 +202,7 @@ class FileValidatorTest extends TestCase
...
@@ -190,7 +202,7 @@ class FileValidatorTest extends TestCase
current
(
$m
->
getErrors
(
'attr_err_ini'
)),
current
(
$m
->
getErrors
(
'attr_err_ini'
)),
str_ireplace
(
str_ireplace
(
array
(
'{file}'
,
'{limit}'
),
array
(
'{file}'
,
'{limit}'
),
array
(
$m
->
attr_err_ini
->
getName
()
,
$val
->
getSizeLimit
()),
array
(
$m
->
attr_err_ini
->
name
,
$val
->
getSizeLimit
()),
$val
->
tooBig
$val
->
tooBig
)
)
)
!==
false
)
!==
false
...
...
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