LocalisationCache: try harder to use LCStoreCDB
[lhc/web/wiklou.git] / tests / phpunit / includes / RevisionTest.php
index fc23919..eb17588 100644 (file)
@@ -173,17 +173,19 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ), "getRevisionText" );
        }
 
-       # =================================================================================================================
+       # =========================================================================
 
        /**
         * @param string $text
         * @param string $title
         * @param string $model
-        * @param null $format
+        * @param string $format
         *
         * @return Revision
         */
-       function newTestRevision( $text, $title = "Test", $model = CONTENT_MODEL_WIKITEXT, $format = null ) {
+       function newTestRevision( $text, $title = "Test",
+               $model = CONTENT_MODEL_WIKITEXT, $format = null
+       ) {
                if ( is_string( $title ) ) {
                        $title = Title::newFromText( $title );
                }
@@ -209,7 +211,7 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        function dataGetContentModel() {
-               //NOTE: we expect the help namespace to always contain wikitext
+               // NOTE: we expect the help namespace to always contain wikitext
                return array(
                        array( 'hello world', 'Help:Hello', null, null, CONTENT_MODEL_WIKITEXT ),
                        array( 'hello world', 'User:hello/there.css', null, null, CONTENT_MODEL_CSS ),
@@ -229,7 +231,7 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        function dataGetContentFormat() {
-               //NOTE: we expect the help namespace to always contain wikitext
+               // NOTE: we expect the help namespace to always contain wikitext
                return array(
                        array( 'hello world', 'Help:Hello', null, null, CONTENT_FORMAT_WIKITEXT ),
                        array( 'hello world', 'Help:Hello', CONTENT_MODEL_CSS, null, CONTENT_FORMAT_CSS ),
@@ -250,7 +252,7 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        function dataGetContentHandler() {
-               //NOTE: we expect the help namespace to always contain wikitext
+               // NOTE: we expect the help namespace to always contain wikitext
                return array(
                        array( 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ),
                        array( 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ),
@@ -270,11 +272,25 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        function dataGetContent() {
-               //NOTE: we expect the help namespace to always contain wikitext
+               // NOTE: we expect the help namespace to always contain wikitext
                return array(
                        array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ),
-                       array( serialize( 'hello world' ), 'Hello', "testing", null, Revision::FOR_PUBLIC, serialize( 'hello world' ) ),
-                       array( serialize( 'hello world' ), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, serialize( 'hello world' ) ),
+                       array(
+                               serialize( 'hello world' ),
+                               'Hello',
+                               "testing",
+                               null,
+                               Revision::FOR_PUBLIC,
+                               serialize( 'hello world' )
+                       ),
+                       array(
+                               serialize( 'hello world' ),
+                               'Dummy:Hello',
+                               null,
+                               null,
+                               Revision::FOR_PUBLIC,
+                               serialize( 'hello world' )
+                       ),
                );
        }
 
@@ -283,15 +299,20 @@ class RevisionTest extends MediaWikiTestCase {
         * @dataProvider dataGetContent
         * @covers Revision::getContent
         */
-       public function testGetContent( $text, $title, $model, $format, $audience, $expectedSerialization ) {
+       public function testGetContent( $text, $title, $model, $format,
+               $audience, $expectedSerialization
+       ) {
                $rev = $this->newTestRevision( $text, $title, $model, $format );
                $content = $rev->getContent( $audience );
 
-               $this->assertEquals( $expectedSerialization, is_null( $content ) ? null : $content->serialize( $format ) );
+               $this->assertEquals(
+                       $expectedSerialization,
+                       is_null( $content ) ? null : $content->serialize( $format )
+               );
        }
 
        function dataGetText() {
-               //NOTE: we expect the help namespace to always contain wikitext
+               // NOTE: we expect the help namespace to always contain wikitext
                return array(
                        array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ),
                        array( serialize( 'hello world' ), 'Hello', "testing", null, Revision::FOR_PUBLIC, null ),
@@ -345,7 +366,11 @@ class RevisionTest extends MediaWikiTestCase {
        public function dataGetSha1() {
                return array(
                        array( "hello world.", CONTENT_MODEL_WIKITEXT, Revision::base36Sha1( "hello world." ) ),
-                       array( serialize( "hello world." ), "testing", Revision::base36Sha1( serialize( "hello world." ) ) ),
+                       array(
+                               serialize( "hello world." ),
+                               "testing",
+                               Revision::base36Sha1( serialize( "hello world." ) )
+                       ),
                );
        }
 
@@ -420,8 +445,10 @@ class RevisionTest extends MediaWikiTestCase {
                $content->setText( "bar" );
 
                $content2 = $rev->getContent( Revision::RAW );
-               $this->assertNotSame( $content, $content2, "expected a clone" ); // content is mutable, expect clone
-               $this->assertEquals( "foo", $content2->getText() ); // clone should contain the original text
+               // content is mutable, expect clone
+               $this->assertNotSame( $content, $content2, "expected a clone" );
+               // clone should contain the original text
+               $this->assertEquals( "foo", $content2->getText() );
 
                $content2->setText( "bla bla" );
                $this->assertEquals( "bar", $content->getText() ); // clones should be independent