// create instance from factory
$instance = call_user_func( $factory, $this->mParent, $name );
- if ( ! $instance instanceof $class ) {
+ if ( !$instance instanceof $class ) {
throw new MWException( "The factory function for module $name did not return an instance of $class!" );
}
} else {
'logout',
'action',
'ApiLogout',
- function( ApiMain $main, $action ) {
- return new ApiLogout( $main, $action );
+ function ( ApiMain $main, $action ) {
+ return new ApiLogout( $main, $action );
},
),
);
),
'logout' => array(
'class' => 'ApiLogout',
- 'factory' => function( ApiMain $main, $action ) {
+ 'factory' => function ( ApiMain $main, $action ) {
return new ApiLogout( $main, $action );
},
),
),
'logout' => array(
'class' => 'ApiLogout',
- 'factory' => function( ApiMain $main, $action ) {
- return new ApiLogout( $main, $action );
- },
+ 'factory' => function ( ApiMain $main, $action ) {
+ return new ApiLogout( $main, $action );
+ },
),
);
* @dataProvider provideDataToEncode
*/
public function testBeautifyUsesFormatJson( $data ) {
- $obj = new JSONContent( FormatJson::encode( $data) );
+ $obj = new JSONContent( FormatJson::encode( $data ) );
$this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() );
}
*/
public function testPreSaveTransform( $data ) {
$obj = new JSONContent( FormatJson::encode( $data ) );
- $newObj = $obj->preSaveTransform( $this->getMockTitle(), $this->getMockUser() , $this->getMockParserOptions() );
+ $newObj = $obj->preSaveTransform( $this->getMockTitle(), $this->getMockUser(), $this->getMockParserOptions() );
$this->assertTrue( $newObj->equals( new JSONContent( FormatJson::encode( $data, true ) ) ) );
}
),
);
}
-
-}
\ No newline at end of file
+}
*/
public function testRegister() {
$factory = new SkinFactory();
- $factory->register( 'fallback', 'Fallback', function() {
+ $factory->register( 'fallback', 'Fallback', function () {
return new SkinFallback();
} );
$this->assertTrue( true ); // No exception thrown