Merge "Fix tests to be compatible with master again"

This commit is contained in:
jenkins-bot 2019-11-19 08:34:14 +00:00 committed by Gerrit Code Review
commit 1a0e198b80
3 changed files with 12 additions and 14 deletions

View file

@ -1,7 +1,7 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "1.0.0",
"mediawiki/mediawiki-codesniffer": "26.0.0",
"mediawiki/mediawiki-codesniffer": "28.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/minus-x": "0.3.1"
},

View file

@ -13,7 +13,7 @@ class Decisions {
private $geoLocation;
private $cache;
const CACHE_KEY = 'cookieWarningIpLookupCache:';
private const CACHE_KEY = 'cookieWarningIpLookupCache:';
/**
* @param Config $config

View file

@ -2,12 +2,14 @@
namespace CookieWarning\Tests;
use CommentStoreComment;
use CookieWarning\GeoLocation;
use CookieWarning\Hooks;
use DerivativeContext;
use FauxRequest;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\SlotRecord;
use MediaWikiLangTestCase;
use MessageCache;
use RequestContext;
use SkinTemplate;
use Title;
@ -19,13 +21,6 @@ use WikitextContent;
* @group Database
*/
class HooksTest extends MediaWikiLangTestCase {
/**
* @throws \MWException
*/
protected function setUp() {
parent::setUp();
MessageCache::singleton()->enable();
}
/**
* @dataProvider providerOnSkinTemplateOutputPageBeforeExec
@ -41,17 +36,20 @@ class HooksTest extends MediaWikiLangTestCase {
'wgCookieWarningForCountryCodes' => false,
'wgUseMediaWikiUIEverywhere' => true,
] );
MediaWikiServices::getInstance()->getMessageCache()->enable();
if ( $morelinkCookieWarningMsg ) {
$title = Title::newFromText( 'cookiewarning-more-link', NS_MEDIAWIKI );
$wikiPage = WikiPage::factory( $title );
$wikiPage->doEditContent( new WikitextContent( $morelinkCookieWarningMsg ),
"CookieWarning test" );
$pageUpdater = $wikiPage->newPageUpdater( \User::newFromName( 'UTSysop' ) );
$pageUpdater->setContent( SlotRecord::MAIN, new WikitextContent( $morelinkCookieWarningMsg ) );
$pageUpdater->saveRevision( CommentStoreComment::newUnsavedComment( 'CookieWarning test' ) );
}
if ( $morelinkCookiePolicyMsg ) {
$title = Title::newFromText( 'cookie-policy-link', NS_MEDIAWIKI );
$wikiPage = WikiPage::factory( $title );
$wikiPage->doEditContent( new WikitextContent( $morelinkCookiePolicyMsg ),
"CookieWarning test" );
$pageUpdater = $wikiPage->newPageUpdater( \User::newFromName( 'UTSysop' ) );
$pageUpdater->setContent( SlotRecord::MAIN, new WikitextContent( $morelinkCookiePolicyMsg ) );
$pageUpdater->saveRevision( CommentStoreComment::newUnsavedComment( 'CookieWarning test' ) );
}
$sk = new SkinTemplate();
$tpl = new \SkinFallbackTemplate();