Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
90.00% covered (success)
90.00%
9 / 10
83.33% covered (warning)
83.33%
5 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
QueryRequestDecorator
90.00% covered (success)
90.00%
9 / 10
83.33% covered (warning)
83.33%
5 / 6
7.05
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 bootstrap
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 getRequest
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 verifyValidResponse
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 shouldDoRequestValidation
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 shouldDoResponseValidation
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Apie\IntegrationTests\Requests;
4
5use Apie\IntegrationTests\Interfaces\TestApplicationInterface;
6use Nyholm\Psr7\Stream;
7use Psr\Http\Message\ResponseInterface;
8use Psr\Http\Message\ServerRequestInterface;
9
10final class QueryRequestDecorator implements TestRequestInterface, BootstrapRequestInterface
11{
12    public function __construct(private readonly TestRequestInterface $decorated)
13    {
14    }
15
16    public function bootstrap(TestApplicationInterface $testApplication): void
17    {
18        if ($this->decorated instanceof BootstrapRequestInterface) {
19            $this->decorated->bootstrap($testApplication);
20        }
21    }
22
23    public function getRequest(): ServerRequestInterface
24    {
25        return $this->decorated->getRequest()
26            ->withMethod('QUERY')
27            ->withHeader('Content-Type', 'application/json')
28            ->withBody(Stream::create('{}'));
29    }
30
31    public function verifyValidResponse(ResponseInterface $response): void
32    {
33        $this->decorated->verifyValidResponse($response);
34    }
35
36    public function shouldDoRequestValidation(): bool
37    {
38        return false;
39    }
40
41    public function shouldDoResponseValidation(): bool
42    {
43        return false;
44    }
45}