createMock(ContentSecurityPolicyManager::class); $policy = $this->createMock(ContentSecurityPolicy::class); $event = new AddContentSecurityPolicyEvent($cspManager); $cspManager->expects($this->once()) ->method('addDefaultPolicy') ->with($policy); $event->addPolicy($policy); } }