diff options
Diffstat (limited to 'www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php')
-rw-r--r-- | www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php b/www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php index 8abd4976..5e82176e 100644 --- a/www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php +++ b/www/wiki/extensions/Translate/tests/phpunit/PageTranslationParserTest.php @@ -1,10 +1,8 @@ <?php /** - * Unit tests for page translation parser - * * @author Niklas Laxström * @copyright Copyright © 2010-2013, Niklas Laxström - * @license GPL-2.0+ + * @license GPL-2.0-or-later * @file */ @@ -18,7 +16,7 @@ class PageTranslationParserTest extends MediaWikiTestCase { $dir = __DIR__; $testFiles = glob( "$dir/pagetranslation/*.ptfile" ); foreach ( $testFiles as $i => $file ) { - $testFiles[$i] = array( $file ); + $testFiles[$i] = [ $file ]; } return $testFiles; @@ -28,13 +26,12 @@ class PageTranslationParserTest extends MediaWikiTestCase { * @dataProvider provideTestFiles */ public function testParsing( $file ) { - $filename = basename( $file ); list( $pagename, ) = explode( '.', $filename, 2 ); $title = Title::newFromText( $pagename ); $translatablePage = TranslatablePage::newFromText( $title, file_get_contents( $file ) ); - $pattern = $file; + $pattern = dirname( $file ) . "/$pagename"; if ( $filename === 'FailNotAtomic.ptfile' ) { $this->markTestSkipped( 'Extended validation not yet implemented' ); @@ -51,12 +48,12 @@ class PageTranslationParserTest extends MediaWikiTestCase { if ( file_exists( "$pattern.ptsource" ) ) { $source = $parse->getSourcePageText(); - $this->assertEquals( $source, file_get_contents( "$pattern.ptsource" ) ); + $this->assertEquals( file_get_contents( "$pattern.ptsource" ), $source ); } if ( file_exists( "$pattern.pttarget" ) ) { - $target = $parse->getTranslationPageText( MessageCollection::newEmpty( 'foo' ) ); - $this->assertEquals( $target, file_get_contents( "$pattern.pttarget" ) ); + $target = $parse->getTranslationPageText( [] ); + $this->assertEquals( file_get_contents( "$pattern.pttarget" ), $target ); } // Custom tests written in php |