summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/tests/phpunit/TPParseTest.php')
-rw-r--r--MLEB/Translate/tests/phpunit/TPParseTest.php61
1 files changed, 0 insertions, 61 deletions
diff --git a/MLEB/Translate/tests/phpunit/TPParseTest.php b/MLEB/Translate/tests/phpunit/TPParseTest.php
deleted file mode 100644
index 8ee4a8e6..00000000
--- a/MLEB/Translate/tests/phpunit/TPParseTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Unit tests for class TPParse
- *
- * @author Niklas Laxström
- * @license GPL-2.0-or-later
- * @file
- */
-
-/**
- * Unit tests for class TPParse
- * @ingroup PageTranslation
- */
-class TPParseTest extends MediaWikiTestCase {
- public function testGetTranslationPageText() {
- $title = Title::newFromText( __CLASS__ );
- $page = TranslatablePage::newFromText(
- $title,
- '<translate>Hello <tvar|abc>peter!</></translate>'
- );
- $prefix = $title->getPrefixedDBkey() . '/';
- $parse = $page->getParse();
-
- $collection = [];
- $expected = 'Hello peter!';
-
- $actual = $parse->getTranslationPageText( $collection );
- $this->assertEquals(
- $expected,
- $actual,
- 'Variable declarations are substituted when no translation'
- );
-
- foreach ( $parse->sections as $section ) {
- $key = $prefix . $section->id;
- $message = new FatMessage( $key, $section->getText() );
- $message->setTranslation( $section->getText() );
- $collection[$key] = $message;
- }
-
- $actual = $parse->getTranslationPageText( $collection );
- $this->assertEquals(
- $expected,
- $actual,
- 'Variable declarations are substituted in source language'
- );
-
- foreach ( $parse->sections as $section ) {
- $key = $prefix . $section->id;
- $message = new FatMessage( $key, $section->getText() );
- $message->setTranslation( $section->getTextForTrans() );
- $collection[$key] = $message;
- }
- $actual = $parse->getTranslationPageText( $collection );
- $this->assertEquals(
- $expected,
- $actual,
- 'Variable declarations are substituted in translation'
- );
- }
-}