Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function doValidation(ResponseInterface $response) |
||
23 | { |
||
24 | // @todo the test should not fail with the first not found header |
||
25 | |||
26 | foreach ($this->checkedHeaders as $headerConfig) { |
||
27 | if (!$response->hasHeader($headerConfig['key'])) { |
||
28 | throw new ValidationFailedException('Header not found (' . $headerConfig['key'] . ')'); |
||
29 | } |
||
30 | |||
31 | $currentValue = $response->getHeader($headerConfig['key'])[0]; |
||
32 | |||
33 | if (!preg_match('%' . $headerConfig['value'] . '%', $currentValue, $matches)) { |
||
34 | throw new ValidationFailedException('Header "' . $headerConfig['key'] . '" does not match "' . $headerConfig['value'] . '". Current value is "' . $currentValue . '"'); |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |