Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
5 / 10
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
GetAndSetUploadedFileField
50.00% covered (danger)
50.00%
5 / 10
50.00% covered (danger)
50.00%
1 / 2
2.50
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 assertResponseValue
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\IntegrationTests\Requests\JsonFields;
3
4use PHPUnit\Framework\TestCase;
5
6class GetAndSetUploadedFileField extends GetAndSetObjectField
7{
8    public function __construct(
9        private readonly string $name,
10        string $fileContents,
11        string $originalFilename,
12        private readonly string $expectedResponse
13    ) {
14        parent::__construct(
15            $name,
16            new GetAndSetPrimitiveField('contents', $fileContents),
17            new GetAndSetPrimitiveField('originalFilename', $originalFilename),
18        );
19    }
20
21    public function assertResponseValue(mixed $responseValue): void
22    {
23        TestCase::assertEquals(
24            $this->expectedResponse,
25            $responseValue,
26            'Field ' . $this->name . ' should contain this value'
27        );
28    }
29}