use MediaWiki\MediaWikiServices;
-class ConfigFactoryTest extends MediaWikiTestCase {
+class ConfigFactoryTest extends \MediaWikiIntegrationTestCase {
/**
* @covers ConfigFactory::register
*/
public function testRegisterInvalid() {
$factory = new ConfigFactory();
- $this->setExpectedException( 'InvalidArgumentException' );
+ $this->setExpectedException( InvalidArgumentException::class );
$factory->register( 'invalid', 'Invalid callback' );
}
$this->assertNotSame( $bar, $newBar, 'don\'t salvage if callbacks differ' );
// the new factory doesn't have quux defined, so the quux instance should not be salvaged
- $this->setExpectedException( 'ConfigException' );
+ $this->setExpectedException( ConfigException::class );
$newFactory->makeConfig( 'quux' );
}
$factory->register( 'unittest', 'GlobalVarConfig::newInstance' );
$conf = $factory->makeConfig( 'unittest' );
- $this->assertInstanceOf( 'Config', $conf );
+ $this->assertInstanceOf( Config::class, $conf );
$this->assertSame( $conf, $factory->makeConfig( 'unittest' ) );
}
$factory = new ConfigFactory();
$factory->register( '*', 'GlobalVarConfig::newInstance' );
$conf = $factory->makeConfig( 'unittest' );
- $this->assertInstanceOf( 'Config', $conf );
+ $this->assertInstanceOf( Config::class, $conf );
}
/**
*/
public function testMakeConfigWithNoBuilders() {
$factory = new ConfigFactory();
- $this->setExpectedException( 'ConfigException' );
+ $this->setExpectedException( ConfigException::class );
$factory->makeConfig( 'nobuilderregistered' );
}
$factory->register( 'unittest', function () {
return true; // Not a Config object
} );
- $this->setExpectedException( 'UnexpectedValueException' );
+ $this->setExpectedException( UnexpectedValueException::class );
$factory->makeConfig( 'unittest' );
}
// NOTE: the global config factory returned here has been overwritten
// for operation in test mode. It may not reflect LocalSettings.
$factory = MediaWikiServices::getInstance()->getConfigFactory();
- $this->assertInstanceOf( 'Config', $factory->makeConfig( 'main' ) );
+ $this->assertInstanceOf( Config::class, $factory->makeConfig( 'main' ) );
}
}