Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
SeededFile | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
create | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\Faker; |
3 | |
4 | use Apie\Core\Enums\UploadedFileStatus; |
5 | use Apie\Core\FileStorage\StoredFile; |
6 | use Apie\Faker\Interfaces\ApieFileFaker; |
7 | use Faker\Generator; |
8 | |
9 | final class SeededFile extends StoredFile |
10 | { |
11 | public static function create(Generator $faker, ApieFileFaker $apieFileFaker): self |
12 | { |
13 | $filename = $apieFileFaker->createOriginalFilename($faker); |
14 | $mimetype = $apieFileFaker->createMimeType(); |
15 | return new self( |
16 | UploadedFileStatus::CreatedLocally, |
17 | clientOriginalFile: $filename, |
18 | clientMimeType: $mimetype, |
19 | serverMimeType: $mimetype, |
20 | resource: $apieFileFaker->createResource($faker, $filename, $mimetype) |
21 | ); |
22 | } |
23 | } |