summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php')
-rw-r--r--MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php b/MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php
index 2ce9401b..174075ad 100644
--- a/MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php
+++ b/MLEB/Translate/tests/phpunit/TranslationFuzzyUpdaterTest.php
@@ -24,7 +24,7 @@ class TranslationFuzzyUpdaterTest extends MediaWikiIntegrationTestCase {
$this->setTemporaryHook( 'TranslatePostInitGroups', [ $this, 'getTestGroups' ] );
$mg = MessageGroups::singleton();
- $mg->setCache( new WANObjectCache( [ 'cache' => wfGetCache( 'hash' ) ] ) );
+ $mg->setCache( new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ) );
$mg->recache();
MessageIndex::setInstance( new HashMessageIndex() );
@@ -43,16 +43,17 @@ class TranslationFuzzyUpdaterTest extends MediaWikiIntegrationTestCase {
}
public function testParsing() {
+ $user = $this->getTestUser()->getUser();
$title = Title::newFromText( 'MediaWiki:Ugakey/nl' );
$page = WikiPage::factory( $title );
$content = ContentHandler::makeContent( '$1 van $2', $title );
- $status = $page->doEditContent( $content, __METHOD__ );
+ $status = TranslateUtils::doPageEdit( $page, $content, $user, __METHOD__ );
$value = $status->getValue();
/** @var RevisionRecord $revisionRecord */
$revisionRecord = $value['revision-record'];
$revisionId = $revisionRecord->getId();
- $dbw = wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_PRIMARY );
$conds = [
'rt_page' => $title->getArticleID(),
'rt_type' => RevTag::getType( 'fuzzy' ),
@@ -67,24 +68,25 @@ class TranslationFuzzyUpdaterTest extends MediaWikiIntegrationTestCase {
$this->assertTrue( $handle->isFuzzy(), 'Message is fuzzy after database fuzzying' );
// Update the translation without the fuzzy string
$content = ContentHandler::makeContent( '$1 van $2', $title );
- $page->doEditContent( $content, __METHOD__ );
+ TranslateUtils::doPageEdit( $page, $content, $user, __METHOD__ );
$this->assertFalse( $handle->isFuzzy(), 'Message is unfuzzy after edit' );
$content = ContentHandler::makeContent( '!!FUZZY!!$1 van $2', $title );
- $page->doEditContent( $content, __METHOD__ );
+ TranslateUtils::doPageEdit( $page, $content, $user, __METHOD__ );
$this->assertTrue( $handle->isFuzzy(), 'Message is fuzzy after manual fuzzying' );
// Update the translation without the fuzzy string
$content = ContentHandler::makeContent( '$1 van $2', $title );
- $page->doEditContent( $content, __METHOD__ );
+ TranslateUtils::doPageEdit( $page, $content, $user, __METHOD__ );
$this->assertFalse( $handle->isFuzzy(), 'Message is unfuzzy after edit' );
}
public function testValidationFuzzy() {
+ $user = $this->getTestUser()->getUser();
$title = Title::newFromText( 'MediaWiki:nlkey/en-gb' );
$page = WikiPage::factory( $title );
$content = ContentHandler::makeContent( 'Test message', $title );
- $page->doEditContent( $content, __METHOD__ );
+ TranslateUtils::doPageEdit( $page, $content, $user, __METHOD__ );
$handle = new MessageHandle( $title );
$this->assertTrue( $handle->isValid(), 'Message is known' );