| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | public function testIndex() |
||
| 10 | { |
||
| 11 | $method = 'POST'; |
||
| 12 | $uri = '/csp/log'; |
||
| 13 | $parameters = []; |
||
| 14 | $files = []; |
||
| 15 | $server = [ |
||
| 16 | 'CONTENT_TYPE' => 'application/json', |
||
| 17 | ]; |
||
| 18 | $content = <<<'JSON' |
||
| 19 | { |
||
| 20 | "csp-report": { |
||
| 21 | "document-uri": "http://example.org/page.html", |
||
| 22 | "referrer": "http://evil.example.com/", |
||
| 23 | "blocked-uri": "http://evil.example.com/evil.js", |
||
| 24 | "violated-directive": "script-src 'self' https://apis.google.com", |
||
| 25 | "original-policy": "script-src 'self' https://apis.google.com; report-uri http://example.org/my_amazing_csp_report_parser" |
||
| 26 | } |
||
| 27 | } |
||
| 28 | JSON; |
||
| 29 | $client = static::createClient(); |
||
| 30 | $client->request($method, $uri, $parameters, $files, $server, $content); |
||
| 31 | $response = $client->getResponse(); |
||
| 32 | $this->assertTrue($response->isSuccessful(), 'Accepting a valid log test failed'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |