-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
The AbstractFile class has the method checkIsUploadedFile. However if I want to mock/fake an uploaded file for in example unit testing, I have implement/override all these classes, since they all extend from it:
- Phalcon\Filter\Validation\Validator\File\Resolution\Min
- Phalcon\Filter\Validation\Validator\File\Resolution\Max
- Phalcon\Filter\Validation\Validator\File\Resolution\Equal
- Phalcon\Filter\Validation\Validator\File\Size\Min
- Phalcon\Filter\Validation\Validator\File\Size\Max
- Phalcon\Filter\Validation\Validator\File\Size\Equal
- Phalcon\Filter\Validation\Validator\File\MimeType
- Phalcon\Filter\Validation\Validator\File
cphalcon/phalcon/Filter/Validation/Validator/File/AbstractFile.zep
Lines 381 to 392 in 83677f1
| /** | |
| * Checks if a file has been uploaded; Internal check that can be | |
| * overridden in a subclass if you do not want to check uploaded files | |
| * | |
| * @param string $name | |
| * | |
| * @return bool | |
| */ | |
| protected function checkIsUploadedFile(string name) -> bool | |
| { | |
| return is_uploaded_file(name); | |
| } |
Would be much easier if an option would be implemented like:
protected function checkIsUploadedFile(string name) -> bool
{
if ($this->getOption('ignoreCheckUploadedFile')) {
return true;
}
return is_uploaded_file(name);
}As an addition, it would also be nice if this validator accepted the Phalcon native $this->request->getUploadedFiles() instead of the PHP's $_FILES.
Metadata
Metadata
Assignees
Labels
No labels