[MediaWiki-commits] [Gerrit] Use and test SVGMessageGroup::register - change (mediawiki...TranslateSvg)
Jarry1250 has submitted this change and it was merged. Change subject: Use and test SVGMessageGroup::register .. Use and test SVGMessageGroup::register Code added in previous commit I7842792 but was previously unused pending implementation of proper unit tests. Change-Id: Iac01b0899c09d07950b400076f2ce6f18dfbd09d --- M tests/phpunit/SVGMessageGroupTest.php M tests/phpunit/TranslateSvgTestCase.php 2 files changed, 15 insertions(+), 6 deletions(-) Approvals: Jarry1250: Verified; Looks good to me, approved diff --git a/tests/phpunit/SVGMessageGroupTest.php b/tests/phpunit/SVGMessageGroupTest.php index cf31fa5..2329825 100644 --- a/tests/phpunit/SVGMessageGroupTest.php +++ b/tests/phpunit/SVGMessageGroupTest.php @@ -18,6 +18,19 @@ self::prepareFile( __DIR__ . '/../data/Speech_bubbles.svg' ); } + public function testRegistration() { + // In order that a lot of the tests function, prepareFile() calls register() + // but we should check now that it's worked + $name = str_replace( '_', ' ', self::$name ); + $group = MessageGroups::getGroup( $name ); + + // $group is either of type SVGMessageGroup (success) or null (failure) + $this->assertInstanceOf( 'SVGMessageGroup', $group ); + + // This should be equivalent to running: + $this->assertInstanceOf( 'SVGMessageGroup', $this->messageGroup ); + } + public function testGetSourceLanguage() { $this->assertEquals( 'en', diff --git a/tests/phpunit/TranslateSvgTestCase.php b/tests/phpunit/TranslateSvgTestCase.php index 88f70bb..005efca 100644 --- a/tests/phpunit/TranslateSvgTestCase.php +++ b/tests/phpunit/TranslateSvgTestCase.php @@ -43,12 +43,8 @@ die( 'Could not upload test file ' . $name ); } - $dbw = wfGetDB( DB_MASTER ); - $table = 'translate_svg'; - $row = array( 'ts_page_id' => $title->getArticleId() ); - $dbw->insert( $table, $row, __METHOD__, array( 'IGNORE' ) ); - MessageGroups::clearCache(); - MessageIndex::singleton()->rebuild(); + $messageGroup = new SVGMessageGroup( $name ); + $messageGroup->register( false ); self::$name = $name; } -- To view, visit https://gerrit.wikimedia.org/r/153332 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iac01b0899c09d07950b400076f2ce6f18dfbd09d Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/TranslateSvg Gerrit-Branch: master Gerrit-Owner: Jarry1250 Gerrit-Reviewer: Jarry1250 Gerrit-Reviewer: Nikerabbit Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use and test SVGMessageGroup::register - change (mediawiki...TranslateSvg)
Jarry1250 has uploaded a new change for review. https://gerrit.wikimedia.org/r/153332 Change subject: Use and test SVGMessageGroup::register .. Use and test SVGMessageGroup::register Change-Id: Iac01b0899c09d07950b400076f2ce6f18dfbd09d --- M tests/phpunit/SVGMessageGroupTest.php M tests/phpunit/TranslateSvgTestCase.php 2 files changed, 12 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TranslateSvg refs/changes/32/153332/1 diff --git a/tests/phpunit/SVGMessageGroupTest.php b/tests/phpunit/SVGMessageGroupTest.php index 2c7bcb2..6349095 100644 --- a/tests/phpunit/SVGMessageGroupTest.php +++ b/tests/phpunit/SVGMessageGroupTest.php @@ -22,6 +22,16 @@ self::prepareFile( $path ); } + public function testRegistration() { + // In order that a lot of the tests function, prepaareFile() calls register() + // but we should check now that it's worked + $name = str_replace( '_', ' ', self::$name ); + $group = MessageGroups::getGroup( $name ); + + // $group is either of type SVGMessageGroup (success) or NULL (failure) + $this->assertTrue( $group instanceof SVGMessageGroup ); + } + public function testGetSourceLanguage() { $messageGroup = new SVGMessageGroup( self::$name ); $expected = 'en'; // None set => 'en' as default diff --git a/tests/phpunit/TranslateSvgTestCase.php b/tests/phpunit/TranslateSvgTestCase.php index 4aae1ad..3febd68 100644 --- a/tests/phpunit/TranslateSvgTestCase.php +++ b/tests/phpunit/TranslateSvgTestCase.php @@ -34,12 +34,8 @@ die( 'Could not upload test file ' . $name ); } - $dbw = wfGetDB( DB_MASTER ); - $table = 'translate_svg'; - $row = array( 'ts_page_id' => $title->getArticleId() ); - $dbw->insert( $table, $row, __METHOD__, array( 'IGNORE' ) ); - MessageGroups::clearCache(); - MessageIndex::singleton()->rebuild(); + $messageGroup = new SVGMessageGroup( $name ); + $messageGroup->register( false ); self::$name = $name; } -- To view, visit https://gerrit.wikimedia.org/r/153332 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac01b0899c09d07950b400076f2ce6f18dfbd09d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TranslateSvg Gerrit-Branch: master Gerrit-Owner: Jarry1250 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits