Jarry1250 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/181569

Change subject: Fix unit tests
......................................................................

Fix unit tests

* Make one test platform independent (re: line-endings)
* Flush database writes later to avoid uncommitted transactions

Change-Id: I94044395dde1dc0fda87fd48fb8b156f41b53e76
---
M tests/phpunit/SVGMessageGroupTest.php
M tests/phpunit/TranslateSvgTestCase.php
2 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg 
refs/changes/69/181569/1

diff --git a/tests/phpunit/SVGMessageGroupTest.php 
b/tests/phpunit/SVGMessageGroupTest.php
index 40b8418..c406102 100644
--- a/tests/phpunit/SVGMessageGroupTest.php
+++ b/tests/phpunit/SVGMessageGroupTest.php
@@ -71,10 +71,8 @@
        }
 
        public function testGetDescription() {
-               // Should be normalised to spaces
-               $name = str_replace( '_', ' ', self::$name );
-               $expected = "[[File:$name|thumb|right|upright|275x275px]]
-<div style=\"overflow:auto; padding:2px;\">Created during testing</div>";
-               $this->assertEquals( $expected, 
$this->messageGroup->getDescription() );
+               $expected = '[[File:' . self::$name . 
'|thumb|right|upright|275x275px]]' . "\n" .
+               '<div style="overflow:auto; padding:2px;">Created during 
testing</div>';
+               $this->assertEquals( $expected, 
$this->messageGroup->getDescription() ."" );
        }
 }
\ No newline at end of file
diff --git a/tests/phpunit/TranslateSvgTestCase.php 
b/tests/phpunit/TranslateSvgTestCase.php
index 4f926d3..0ef7a15 100644
--- a/tests/phpunit/TranslateSvgTestCase.php
+++ b/tests/phpunit/TranslateSvgTestCase.php
@@ -63,6 +63,9 @@
                // Preserve the syntax of $this->setMwGlobals for future use
                // but we can't use it te way it's written at the moment since 
we're static
                $pairs = array(
+                       // Enable uploads
+                       'wgEnableUploads' => true,
+
                        // Add .svg to list of supported file extensions
                        'wgFileExtensions' => array( 'png', 'gif', 'jpg', 
'jpeg', 'svg' ),
 
@@ -107,7 +110,6 @@
 
                $conds = array( 'tmd_group' => self::$name );
                $dbw->delete( 'translate_metadata', $conds, __METHOD__ );
-               $dbw->commit( __METHOD__, 'flush' );
 
                if( !$title->exists() ) {
                        return;
@@ -122,5 +124,7 @@
 
                $wikiPage = new WikiPage( $title );
                $wikiPage->doDeleteArticle( 'resetting' );
+
+               $dbw->commit( __METHOD__, 'flush' );
        }
 }
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/181569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94044395dde1dc0fda87fd48fb8b156f41b53e76
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TranslateSvg
Gerrit-Branch: master
Gerrit-Owner: Jarry1250 <jarry1...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to