aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/phpunit/includes/MessageTest.php7
-rw-r--r--tests/phpunit/includes/api/ApiMessageTest.php14
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php
index 758cf167f343..d6dfccce590c 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -1,6 +1,7 @@
<?php
use MediaWiki\MediaWikiServices;
+use MediaWiki\Page\PageReference;
use Wikimedia\TestingAccessWrapper;
/**
@@ -867,9 +868,9 @@ class MessageTest extends MediaWikiLangTestCase {
$this->assertSame( '(<a>foo</a>)', $msg->parse(), 'Sanity check' );
$msg = unserialize( serialize( $msg ) );
$this->assertSame( '(<a>foo</a>)', $msg->parse() );
- $title = TestingAccessWrapper::newFromObject( $msg )->title;
- $this->assertInstanceOf( Title::class, $title );
- $this->assertSame( 'Testing', $title->getFullText() );
+ $title = TestingAccessWrapper::newFromObject( $msg )->contextPage;
+ $this->assertInstanceOf( PageReference::class, $title );
+ $this->assertSame( 'Testing', $title->getDbKey() );
$msg = new Message( 'mainpage' );
$msg->inLanguage( 'de' );
diff --git a/tests/phpunit/includes/api/ApiMessageTest.php b/tests/phpunit/includes/api/ApiMessageTest.php
index fafcd92b815d..227313be5606 100644
--- a/tests/phpunit/includes/api/ApiMessageTest.php
+++ b/tests/phpunit/includes/api/ApiMessageTest.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\Page\PageReferenceValue;
use Wikimedia\TestingAccessWrapper;
/**
@@ -19,8 +20,8 @@ class ApiMessageTest extends MediaWikiIntegrationTestCase {
$this->assertSame( $msg->useDatabase, $msg2->useDatabase, 'useDatabase' );
$this->assertSame( $msg->format, $msg2->format, 'format' );
$this->assertSame(
- $msg->title ? $msg->title->getFullText() : null,
- $msg2->title ? $msg2->title->getFullText() : null,
+ $msg->contextPage ? "{$msg->contextPage->getNamespace()}:{$msg->contextPage->getDbKey()}" : null,
+ $msg2->contextPage ? "{$msg->contextPage->getNamespace()}:{$msg->contextPage->getDbKey()}" : null,
'title'
);
}
@@ -81,7 +82,10 @@ class ApiMessageTest extends MediaWikiIntegrationTestCase {
*/
public function testApiMessage() {
$msg = new Message( [ 'foo', 'bar' ], [ 'baz' ] );
- $msg->inLanguage( 'de' )->title( Title::newMainPage() );
+ $msg->inLanguage( 'de' )
+ ->page(
+ PageReferenceValue::localReference( NS_MAIN, 'Main_Page' )
+ );
$msg2 = new ApiMessage( $msg, 'code', [ 'data' ] );
$this->compareMessages( $msg, $msg2 );
$this->assertEquals( 'code', $msg2->getApiCode() );
@@ -120,7 +124,9 @@ class ApiMessageTest extends MediaWikiIntegrationTestCase {
*/
public function testApiRawMessage() {
$msg = new RawMessage( 'foo', [ 'baz' ] );
- $msg->inLanguage( 'de' )->title( Title::newMainPage() );
+ $msg->inLanguage( 'de' )->page(
+ PageReferenceValue::localReference( NS_MAIN, 'Main_Page' )
+ );
$msg2 = new ApiRawMessage( $msg, 'code', [ 'data' ] );
$this->compareMessages( $msg, $msg2 );
$this->assertEquals( 'code', $msg2->getApiCode() );