From: Timo Tijhof Date: Wed, 3 Dec 2014 01:52:00 +0000 (+0000) Subject: content: Re-arange tests to declare data provider first X-Git-Tag: 1.31.0-rc.0~13113 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22brouteur%22%2C%28%24id_rubrique%20?a=commitdiff_plain;h=b7a0f77800be3dbbadb7eb71ec9681abe4de355c;p=lhc%2Fweb%2Fwiklou.git content: Re-arange tests to declare data provider first For consistency with other test suites. Change-Id: Ic4b4d8e228a9ce82a42a07d88d690a9c932960c3 --- diff --git a/tests/phpunit/includes/content/JsonContentTest.php b/tests/phpunit/includes/content/JsonContentTest.php index 77b542f4b3..d4151a5c24 100644 --- a/tests/phpunit/includes/content/JsonContentTest.php +++ b/tests/phpunit/includes/content/JsonContentTest.php @@ -6,15 +6,6 @@ */ class JsonContentTest extends MediaWikiLangTestCase { - /** - * @dataProvider provideValidConstruction - */ - public function testValidConstruct( $text, $modelId, $isValid, $expected ) { - $obj = new JsonContent( $text, $modelId ); - $this->assertEquals( $isValid, $obj->isValid() ); - $this->assertEquals( $expected, $obj->getJsonData() ); - } - public static function provideValidConstruction() { return array( array( 'foo', CONTENT_MODEL_JSON, false, null ), @@ -24,11 +15,12 @@ class JsonContentTest extends MediaWikiLangTestCase { } /** - * @dataProvider provideDataToEncode + * @dataProvider provideValidConstruction */ - public function testBeautifyUsesFormatJson( $data ) { - $obj = new JsonContent( FormatJson::encode( $data ) ); - $this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() ); + public function testValidConstruct( $text, $modelId, $isValid, $expected ) { + $obj = new JsonContent( $text, $modelId ); + $this->assertEquals( $isValid, $obj->isValid() ); + $this->assertEquals( $expected, $obj->getJsonData() ); } public static function provideDataToEncode() { @@ -41,6 +33,14 @@ class JsonContentTest extends MediaWikiLangTestCase { ); } + /** + * @dataProvider provideDataToEncode + */ + public function testBeautifyUsesFormatJson( $data ) { + $obj = new JsonContent( FormatJson::encode( $data ) ); + $this->assertEquals( FormatJson::encode( $data, true ), $obj->beautifyJSON() ); + } + /** * @dataProvider provideDataToEncode */ @@ -67,16 +67,6 @@ class JsonContentTest extends MediaWikiLangTestCase { ->getMock(); } - /** - * @dataProvider provideDataAndParserText - */ - public function testFillParserOutput( $data, $expected ) { - $obj = new JsonContent( FormatJson::encode( $data ) ); - $parserOutput = $obj->getParserOutput( $this->getMockTitle(), null, null, true ); - $this->assertInstanceOf( 'ParserOutput', $parserOutput ); - $this->assertEquals( $expected, $parserOutput->getText() ); - } - public static function provideDataAndParserText() { return array( array( @@ -111,4 +101,14 @@ class JsonContentTest extends MediaWikiLangTestCase { ), ); } + + /** + * @dataProvider provideDataAndParserText + */ + public function testFillParserOutput( $data, $expected ) { + $obj = new JsonContent( FormatJson::encode( $data ) ); + $parserOutput = $obj->getParserOutput( $this->getMockTitle(), null, null, true ); + $this->assertInstanceOf( 'ParserOutput', $parserOutput ); + $this->assertEquals( $expected, $parserOutput->getText() ); + } }