X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fphpunit%2Fmaintenance%2FDumpTestCase.php;h=3dbd9edcc1f2118972d174ca01b78be220d45d31;hb=b801fa8b3b3b42fb6db9129d4642f6e583b56879;hp=fd39c45b0e8bdf1b19ad46b0719a2a45e29c640f;hpb=2f5914c2ce4c612920dd96f5ef66e3bd342d2195;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index fd39c45b0e..3dbd9edcc1 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -1,11 +1,9 @@ assertNodeStart( "revision" ); $this->skipWhitespace(); $this->assertTextNode( "id", $id ); + if( $parentid ) { + $this->assertTextNode( "parentid", $parentid ); + } $this->assertTextNode( "timestamp", false ); $this->assertNodeStart( "contributor" ); @@ -313,14 +319,39 @@ abstract class DumpTestCase extends MediaWikiTestCase { $this->skipWhitespace(); $this->assertTextNode( "comment", $summary ); + $this->skipWhitespace(); + + if ( $this->xml->name == "text" ) { + // note: 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, "Attribute 'bytes' of revision " . $id ); } - if ( $text === false ) { // Testing for a stub $this->assertEquals( $this->xml->getAttribute( "id" ), $text_id, @@ -342,10 +373,7 @@ abstract class DumpTestCase extends MediaWikiTestCase { $this->skipWhitespace(); } - $this->assertTextNode( "sha1", $text_sha1 ); - $this->assertNodeEnd( "revision" ); $this->skipWhitespace(); } - }