// Note, there are some obscure globals which
// could affect the results which aren't included above.
- RepoGroup::destroySingleton();
+ $this->overrideMwServices();
$context = RequestContext::getMain();
$resp = $context->getRequest()->response();
$conf = $context->getConfig();
* @covers ContentSecurityPolicy::isNonceRequired
*/
public function testCSPIsEnabled( $main, $reportOnly, $expected ) {
- global $wgCSPReportOnlyHeader, $wgCSPHeader;
- global $wgCSPHeader;
- $oldReport = wfSetVar( $wgCSPReportOnlyHeader, $reportOnly );
- $oldMain = wfSetVar( $wgCSPHeader, $main );
+ $this->setMwGlobals( 'wgCSPReportOnlyHeader', $reportOnly );
+ $this->setMwGlobals( 'wgCSPHeader', $main );
$res = ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() );
- wfSetVar( $wgCSPReportOnlyHeader, $oldReport );
- wfSetVar( $wgCSPHeader, $oldMain );
$this->assertEquals( $res, $expected );
}