File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public function testValidUploadedFile()
17
17
'type ' => 'text/plain ' ,
18
18
'size ' => filesize (__FILE__ ),
19
19
'tmp_name ' => __FILE__ ,
20
- 'error ' => 0
20
+ 'error ' => UPLOAD_ERR_OK
21
21
];
22
22
23
23
$ uploadedFileRule = $ this ->getMockBuilder (UploadedFile::class)
@@ -31,10 +31,24 @@ public function testValidUploadedFile()
31
31
$ this ->assertTrue ($ uploadedFileRule ->check ($ file ));
32
32
}
33
33
34
+ /**
35
+ * Make sure we can't just passing array like valid $_FILES['key']
36
+ */
37
+ public function testValidateWithoutMockShouldBeInvalid ()
38
+ {
39
+ $ this ->assertFalse ($ this ->rule ->check ([
40
+ 'name ' => pathinfo (__FILE__ , PATHINFO_BASENAME ),
41
+ 'type ' => 'text/plain ' ,
42
+ 'size ' => filesize (__FILE__ ),
43
+ 'tmp_name ' => __FILE__ ,
44
+ 'error ' => UPLOAD_ERR_OK
45
+ ]));
46
+ }
47
+
34
48
/**
35
49
* Missing UPLOAD_ERR_NO_FILE should be valid because it is job for required rule
36
50
*/
37
- public function testNoUploadedFileShouldBeValid ()
51
+ public function testEmptyUploadedFileShouldBeValid ()
38
52
{
39
53
$ this ->assertTrue ($ this ->rule ->check ([
40
54
'name ' => '' ,
You can’t perform that action at this time.
0 commit comments