diff options
Diffstat (limited to 'tests/phpunit/includes/content/TextContentTest.php')
-rw-r--r-- | tests/phpunit/includes/content/TextContentTest.php | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/tests/phpunit/includes/content/TextContentTest.php b/tests/phpunit/includes/content/TextContentTest.php index 57b7c1023f6c..382f71a8664e 100644 --- a/tests/phpunit/includes/content/TextContentTest.php +++ b/tests/phpunit/includes/content/TextContentTest.php @@ -143,7 +143,7 @@ class TextContentTest extends MediaWikiLangTestCase { */ public function testGetRedirectTarget( $text, $expected ) { $content = $this->newContent( $text ); - $t = $content->getRedirectTarget( ); + $t = $content->getRedirectTarget(); if ( is_null( $expected ) ) { $this->assertNull( $t, "text should not have generated a redirect target: $text" ); @@ -158,7 +158,7 @@ class TextContentTest extends MediaWikiLangTestCase { public function testIsRedirect( $text, $expected ) { $content = $this->newContent( $text ); - $this->assertEquals( !is_null($expected), $content->isRedirect() ); + $this->assertEquals( !is_null( $expected ), $content->isRedirect() ); } /** @@ -184,29 +184,28 @@ class TextContentTest extends MediaWikiLangTestCase { public static function dataIsCountable() { return array( array( '', - null, - 'any', - true + null, + 'any', + true ), array( 'Foo', - null, - 'any', - true + null, + 'any', + true ), array( 'Foo', - null, - 'comma', - false + null, + 'comma', + false ), array( 'Foo, bar', - null, - 'comma', - false + null, + 'comma', + false ), ); } - /** * @dataProvider dataIsCountable * @group Database @@ -223,22 +222,22 @@ class TextContentTest extends MediaWikiLangTestCase { $wgArticleCountMethod = $old; $this->assertEquals( $expected, $v, 'isCountable() returned unexpected value ' . var_export( $v, true ) - . ' instead of ' . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); + . ' instead of ' . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); } public static function dataGetTextForSummary() { return array( array( "hello\nworld.", - 16, - 'hello world.', + 16, + 'hello world.', ), array( 'hello world.', - 8, - 'hello...', + 8, + 'hello...', ), array( '[[hello world]].', - 8, - '[[hel...', + 8, + '[[hel...', ), ); } @@ -252,8 +251,7 @@ class TextContentTest extends MediaWikiLangTestCase { $this->assertEquals( $expected, $content->getTextForSummary( $maxlength ) ); } - - public function testGetTextForSearchIndex( ) { + public function testGetTextForSearchIndex() { $content = $this->newContent( 'hello world.' ); $this->assertEquals( 'hello world.', $content->getTextForSearchIndex() ); @@ -267,19 +265,19 @@ class TextContentTest extends MediaWikiLangTestCase { $this->assertEquals( 'hello world.', $copy->getNativeData() ); } - public function testGetSize( ) { + public function testGetSize() { $content = $this->newContent( 'hello world.' ); $this->assertEquals( 12, $content->getSize() ); } - public function testGetNativeData( ) { + public function testGetNativeData() { $content = $this->newContent( 'hello world.' ); $this->assertEquals( 'hello world.', $content->getNativeData() ); } - public function testGetWikitextForTransclusion( ) { + public function testGetWikitextForTransclusion() { $content = $this->newContent( 'hello world.' ); $this->assertEquals( 'hello world.', $content->getWikitextForTransclusion() ); @@ -297,7 +295,7 @@ class TextContentTest extends MediaWikiLangTestCase { $this->assertEquals( CONTENT_MODEL_TEXT, $content->getContentHandler()->getModelID() ); } - public static function dataIsEmpty( ) { + public static function dataIsEmpty() { return array( array( '', true ), array( ' ', false ), @@ -315,7 +313,7 @@ class TextContentTest extends MediaWikiLangTestCase { $this->assertEquals( $empty, $content->isEmpty() ); } - public static function dataEquals( ) { + public static function dataEquals() { return array( array( new TextContent( "hallo" ), null, false ), array( new TextContent( "hallo" ), new TextContent( "hallo" ), true ), @@ -334,13 +332,13 @@ class TextContentTest extends MediaWikiLangTestCase { public static function dataGetDeletionUpdates() { return array( - array("TextContentTest_testGetSecondaryDataUpdates_1", + array( "TextContentTest_testGetSecondaryDataUpdates_1", CONTENT_MODEL_TEXT, "hello ''world''\n", - array( ) + array() ), - array("TextContentTest_testGetSecondaryDataUpdates_2", + array( "TextContentTest_testGetSecondaryDataUpdates_2", CONTENT_MODEL_TEXT, "hello [[world test 21344]]\n", - array( ) + array() ), // TODO: more...? ); @@ -363,7 +361,7 @@ class TextContentTest extends MediaWikiLangTestCase { // make updates accessible by class name foreach ( $updates as $update ) { $class = get_class( $update ); - $updates[ $class ] = $update; + $updates[$class] = $update; } if ( !$expectedStuff ) { @@ -374,7 +372,7 @@ class TextContentTest extends MediaWikiLangTestCase { foreach ( $expectedStuff as $class => $fieldValues ) { $this->assertArrayHasKey( $class, $updates, "missing an update of type $class" ); - $update = $updates[ $class ]; + $update = $updates[$class]; foreach ( $fieldValues as $field => $value ) { $v = $update->$field; #if the field doesn't exist, just crash and burn |