<?php
+use MediaWiki\MediaWikiServices;
+
/**
* @group ContentHandler
* @group Database
* @covers TextContent::preSaveTransform
*/
public function testPreSaveTransform( $text, $expected ) {
- global $wgContLang;
-
- $options = ParserOptions::newFromUserAndLang( $this->context->getUser(), $wgContLang );
+ $options = ParserOptions::newFromUserAndLang( $this->context->getUser(),
+ MediaWikiServices::getInstance()->getContentLanguage() );
$content = $this->newContent( $text );
$content = $content->preSaveTransform(
* @covers TextContent::preloadTransform
*/
public function testPreloadTransform( $text, $expected ) {
- global $wgContLang;
- $options = ParserOptions::newFromUserAndLang( $this->context->getUser(), $wgContLang );
+ $options = ParserOptions::newFromUserAndLang( $this->context->getUser(),
+ MediaWikiServices::getInstance()->getContentLanguage() );
$content = $this->newContent( $text );
$content = $content->preloadTransform( $this->context->getTitle(), $options );
'any',
true
],
- [ 'Foo',
- null,
- 'comma',
- false
- ],
- [ 'Foo, bar',
- null,
- 'comma',
- false
- ],
];
}
if ( $expectedNative === false ) {
$this->assertFalse( $converted, "conversion to $model was expected to fail!" );
} else {
- $this->assertInstanceOf( 'Content', $converted );
+ $this->assertInstanceOf( Content::class, $converted );
$this->assertEquals( $expectedNative, $converted->getNativeData() );
}
}