use Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ContentSecurityPolicyHandlerTest extends TestCase
{ /**
* @dataProvider provideRequestAndResponses
*/
public function testGetNonces($nonce,
$expectedNonce, Request
$request, Response
$response) { $cspHandler =
new ContentSecurityPolicyHandler($this->
mockNonceGenerator($nonce));
$this->
assertSame($expectedNonce,
$cspHandler->
getNonces($request,
$response));
} /**
* @dataProvider provideRequestAndResponsesForOnKernelResponse
*/
public function testOnKernelResponse($nonce,
$expectedNonce, Request
$request, Response
$response, array
$expectedCsp) { $cspHandler =
new ContentSecurityPolicyHandler($this->
mockNonceGenerator($nonce));