'msg' => 'Version falls back gracefully if getVersionHash throws',
'modules' => [
'test.fail' => (
- ( $mock = $this->getMockBuilder( 'ResourceLoaderTestModule' )
+ ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
->setMethods( [ 'getVersionHash' ] )->getMock() )
&& $mock->method( 'getVersionHash' )->will(
$this->throwException( new Exception )
'msg' => 'Use version from getVersionHash',
'modules' => [
'test.version' => (
- ( $mock = $this->getMockBuilder( 'ResourceLoaderTestModule' )
+ ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
->setMethods( [ 'getVersionHash' ] )->getMock() )
&& $mock->method( 'getVersionHash' )->willReturn( '1234567' )
) ? $mock : $mock
'msg' => 'Re-hash version from getVersionHash if too long',
'modules' => [
'test.version' => (
- ( $mock = $this->getMockBuilder( 'ResourceLoaderTestModule' )
+ ( $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
->setMethods( [ 'getVersionHash' ] )->getMock() )
&& $mock->method( 'getVersionHash' )->willReturn( '12345678' )
) ? $mock : $mock
$module = new ResourceLoaderStartUpModule();
$out = ltrim( $case['out'], "\n" );
+ // Disable log from getModuleRegistrations via MWExceptionHandler
+ // for case where getVersionHash() is expected to throw.
+ $this->setLogger( 'exception', new Psr\Log\NullLogger() );
+
$this->assertEquals(
self::expandPlaceholders( $out ),
$module->getModuleRegistrations( $context ),