1 | <?php |
||
12 | trait UploadedFileTestable |
||
13 | { |
||
14 | /** |
||
15 | * Implemented in PHPUnit |
||
16 | * Asserts that a file exists. |
||
17 | * |
||
18 | * @param string $filename |
||
19 | * @param string $message |
||
20 | * |
||
21 | */ |
||
22 | abstract public static function assertFileExists(string $filename, string $message = ''): void; |
||
23 | |||
24 | /** |
||
25 | * Create an instance of Illuminate\Http\UploadedFile for testing (param test=true). |
||
26 | * Before creating UploadedFile class check if file exists with assertFileExists($fullPath). |
||
27 | * @param string $fullPath |
||
28 | * @param string $mimeType if empty try to resolve mimeType automatically. |
||
29 | * @param int $errorCode default 0 (no error). |
||
30 | * For all possible values see Symfony\Component\HttpFoundation\File\UploadedFile::getErrorMessage() |
||
31 | * @return UploadedFile |
||
32 | * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException |
||
33 | * @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException |
||
34 | */ |
||
35 | public function getUploadedFileForTest(string $fullPath, string $mimeType = '', int $errorCode = 0) : UploadedFile |
||
49 | |||
50 | /** |
||
51 | * Take $fullPath existing file, copy it to system temp dir with random name and |
||
52 | * Create an instance of Illuminate\Http\UploadedFile for testing (param test=true). |
||
53 | * Before creating UploadedFile class check if file exists with assertFileExists($fullPath). |
||
54 | * @param string $fullPath |
||
55 | * @param string $mimeType if empty try to resolve mimeType automatically. |
||
56 | * @param int $errorCode default 0 (no error). |
||
57 | * For all possible values see Symfony\Component\HttpFoundation\File\UploadedFile::getErrorMessage() |
||
58 | * @return UploadedFile |
||
59 | * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException |
||
60 | * @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException |
||
61 | */ |
||
62 | public function getUploadedFileForTestAndCopyInSysTempDir( |
||
80 | } |
||
81 |