Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
SeededFile
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 create
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\Faker;
3
4use Apie\Core\Enums\UploadedFileStatus;
5use Apie\Core\FileStorage\StoredFile;
6use Apie\Faker\Interfaces\ApieFileFaker;
7use Faker\Generator;
8
9final 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}