Merge "tests: Fix some issues with overwriting outputs from PHP tests"

This commit is contained in:
jenkins-bot 2020-08-11 21:19:12 +00:00 committed by Gerrit Code Review
commit 605b164616
3 changed files with 9 additions and 6 deletions

View file

@ -234,11 +234,14 @@ class CommentParserTest extends CommentTestCase {
$thread = self::serializeComments( $thread, $body );
$thread = json_decode( json_encode( $thread ), true );
$processedThreads[] = $thread;
self::assertEquals( $expected[$i], $processedThreads[$i], $name . ' section ' . $i );
}
// Uncomment this to write updated content to the JSON files:
// self::overwriteJsonFile( $expectedPath, $processedThreads );
foreach ( $threads as $i => $thread ) {
self::assertEquals( $expected[$i], $processedThreads[$i], $name . ' section ' . $i );
}
}
public function provideComments() : array {

View file

@ -80,7 +80,7 @@ abstract class CommentTestCase extends MediaWikiTestCase {
protected static function overwriteHtmlFile( string $relPath, DOMDocument $doc, string $origRelPath ) : void {
// Do not use $doc->saveHtml(), it outputs an awful soup of HTML entities for documents with
// non-ASCII characters
$html = file_get_contents( __DIR__ . '/../' . $origRelativePath );
$html = file_get_contents( __DIR__ . '/../' . $origRelPath );
// Replace the body tag only in full Parsoid docs
if ( strpos( $html, '<body' ) !== false ) {
@ -95,7 +95,7 @@ abstract class CommentTestCase extends MediaWikiTestCase {
$html = DOMCompat::getInnerHTML( $doc->getElementsByTagName( 'body' )->item( 0 ) );
}
file_put_contents( __DIR__ . '/../' . $relativePath, $html );
file_put_contents( __DIR__ . '/../' . $relPath, $html );
}
/**

View file

@ -74,14 +74,14 @@ class ThreadItemTest extends CommentTestCase {
$transcludedFrom[ $comment->getId() ] = $comment->getTranscludedFrom();
}
// Uncomment this to write updated content to the JSON files:
// self::overwriteJsonFile( $expectedPath, $transcludedFrom );
self::assertEquals(
$expected,
$transcludedFrom,
$name
);
// Uncomment this to write updated content to the JSON files:
// self::overwriteJsonFile( $expectedPath, $transcludedFrom );
}
public function provideTranscludedFrom() : array {