mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Merge "Better way to update expected test outputs"
This commit is contained in:
commit
1802e9c017
|
@ -1,4 +1,10 @@
|
|||
The HTML files were saved from:
|
||||
To update the expected outputs, run the PHP tests with the environment variable
|
||||
"DISCUSSIONTOOLS_OVERWRITE_TESTS" set to any value, e.g.:
|
||||
|
||||
DISCUSSIONTOOLS_OVERWRITE_TESTS=1 php tests/phpunit/phpunit.php extensions/DiscussionTools/tests/phpunit/
|
||||
|
||||
|
||||
The input HTML files were saved from:
|
||||
|
||||
pl-big:
|
||||
https://pl.wikipedia.org/w/index.php?action=render&title=Wikipedia:Kawiarenka/Artyku%C5%82y_dyskusja/Archiwum/2018-pa%C5%BAdziernik&oldid=55171451
|
||||
|
|
|
@ -43,8 +43,10 @@ class CommentModifierTest extends CommentTestCase {
|
|||
|
||||
$expectedDoc = self::createDocument( $expected );
|
||||
|
||||
// Uncomment this to write updated content to the "modified HTML" files:
|
||||
// self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
// Optionally write updated content to the "modified HTML" files
|
||||
if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) {
|
||||
self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
}
|
||||
|
||||
// saveHtml is not dirty-diff safe, but for testing it is probably faster than DOMCompat::getOuterHTML
|
||||
self::assertEquals( $expectedDoc->saveHtml(), $doc->saveHtml(), $name );
|
||||
|
@ -87,8 +89,10 @@ class CommentModifierTest extends CommentTestCase {
|
|||
|
||||
$expectedDoc = self::createDocument( $expected );
|
||||
|
||||
// Uncomment this to write updated content to the "reply HTML" files:
|
||||
// self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
// Optionally write updated content to the "reply HTML" files
|
||||
if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) {
|
||||
self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
}
|
||||
|
||||
// saveHtml is not dirty-diff safe, but for testing it is probably faster than DOMCompat::getOuterHTML
|
||||
self::assertEquals( $expectedDoc->saveHtml(), $doc->saveHtml(), $name );
|
||||
|
|
|
@ -203,8 +203,10 @@ class CommentParserTest extends CommentTestCase {
|
|||
$processedThreads[] = $thread;
|
||||
}
|
||||
|
||||
// Uncomment this to write updated content to the JSON files:
|
||||
// self::overwriteJsonFile( $expectedPath, $processedThreads );
|
||||
// Optionally write updated content to the JSON files
|
||||
if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) {
|
||||
self::overwriteJsonFile( $expectedPath, $processedThreads );
|
||||
}
|
||||
|
||||
foreach ( $threads as $i => $thread ) {
|
||||
self::assertEquals( $expected[$i], $processedThreads[$i], $name . ' section ' . $i );
|
||||
|
|
|
@ -24,8 +24,10 @@ class DataTest extends CommentTestCase {
|
|||
|
||||
$data = Data::getLocalData( null, $conf, $langCode );
|
||||
|
||||
// Uncomment this to write updated content to the JSON files:
|
||||
// self::overwriteJsonFile( $expectedPath, $data );
|
||||
// Optionally write updated content to the JSON files
|
||||
if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) {
|
||||
self::overwriteJsonFile( $expectedPath, $data );
|
||||
}
|
||||
|
||||
self::assertEquals( $expectedData, $data );
|
||||
}
|
||||
|
|
|
@ -74,8 +74,10 @@ class ThreadItemTest extends CommentTestCase {
|
|||
$transcludedFrom[ $comment->getId() ] = $comment->getTranscludedFrom();
|
||||
}
|
||||
|
||||
// Uncomment this to write updated content to the JSON files:
|
||||
// self::overwriteJsonFile( $expectedPath, $transcludedFrom );
|
||||
// Optionally write updated content to the JSON files
|
||||
if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) {
|
||||
self::overwriteJsonFile( $expectedPath, $transcludedFrom );
|
||||
}
|
||||
|
||||
self::assertEquals(
|
||||
$expected,
|
||||
|
|
Loading…
Reference in a new issue