Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
77.78% |
7 / 9 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| GetAndSetPrimitiveField | |
77.78% |
7 / 9 |
|
75.00% |
3 / 4 |
5.27 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getInputValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| assertResponseValue | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Apie\IntegrationTests\Requests\JsonFields; |
| 4 | |
| 5 | use PHPUnit\Framework\TestCase; |
| 6 | |
| 7 | class GetAndSetPrimitiveField implements JsonGetFieldInterface, JsonSetFieldInterface |
| 8 | { |
| 9 | public function __construct( |
| 10 | private readonly string $name, |
| 11 | private readonly mixed $input, |
| 12 | private mixed $output = null |
| 13 | ) { |
| 14 | if (func_num_args() < 3) { |
| 15 | $this->output = $input; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function getName(): string |
| 20 | { |
| 21 | return $this->name; |
| 22 | } |
| 23 | |
| 24 | public function getInputValue(): mixed |
| 25 | { |
| 26 | return $this->input; |
| 27 | } |
| 28 | |
| 29 | public function assertResponseValue(mixed $responseValue): void |
| 30 | { |
| 31 | TestCase::assertEquals( |
| 32 | $this->output, |
| 33 | $responseValue, |
| 34 | 'Field ' . $this->name . ' should contain this value' |
| 35 | ); |
| 36 | } |
| 37 | } |