merged master
[lhc/web/wiklou.git] / tests / phpunit / maintenance / DumpTestCase.php
index e71e76c..3dbd9ed 100644 (file)
@@ -295,9 +295,13 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
         * @param $text_sha1 string: the base36 SHA-1 of the revision's text
         * @param $text string|false: (optional) The revision's string, or false to check for a
         *            revision stub
+        * @param $model int: the expected content model id (default: CONTENT_MODEL_WIKITEXT)
+        * @param $format int: the expected format model id (default: CONTENT_FORMAT_WIKITEXT)
         * @param $parentid int|false: (optional) id of the parent revision
         */
-       protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, $parentid = false ) {
+       protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, 
+                                               $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT,
+                                               $parentid = false ) {
 
                $this->assertNodeStart( "revision" );
                $this->skipWhitespace();
@@ -315,9 +319,33 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                $this->skipWhitespace();
 
                $this->assertTextNode( "comment", $summary );
+               $this->skipWhitespace();
+
+               if ( $this->xml->name == "text" ) {
+                       // note: <text> tag may occur here or at the very end.
+                       $text_found = true;
+                       $this->assertText( $id, $text_id, $text_bytes, $text );
+               } else {
+                       $text_found = false;
+               }
 
                $this->assertTextNode( "sha1", $text_sha1 );
 
+               $this->assertTextNode( "model", $model );
+               $this->skipWhitespace();
+
+               $this->assertTextNode( "format", $format );
+               $this->skipWhitespace();
+
+               if ( !$text_found ) {
+                       $this->assertText( $id, $text_id, $text_bytes, $text );
+               }
+
+               $this->assertNodeEnd( "revision" );
+               $this->skipWhitespace();
+       }
+
+       protected function assertText( $id, $text_id, $text_bytes, $text ) {
                $this->assertNodeStart( "text", false );
                if ( $text_bytes !== false ) {
                        $this->assertEquals( $this->xml->getAttribute( "bytes" ), $text_bytes,
@@ -348,5 +376,4 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                $this->assertNodeEnd( "revision" );
                $this->skipWhitespace();
        }
-
 }