Page MenuHomePhabricator

Wikibase OutputPageBeforeHTMLHookHandlerTest::testOutputPageBeforeHTMLHookHandler failing on Travis CI
Closed, ResolvedPublic

Description

Build turned red on https://travis-ci.org/wikimedia/mediawiki-extensions-Wikibase/builds/580466080

Tests failures happen when the wiki language is other than English, see e.g. https://travis-ci.org/wikimedia/mediawiki-extensions-Wikibase/jobs/580466081

There was 1 failure:

1) Wikibase\Repo\Tests\Hooks\OutputPageBeforeHTMLHookHandlerTest::testOutputPageBeforeHTMLHookHandler

=== Logs generated by test case

[wfDebug] [debug] IP: 127.0.0.1 {"private":false}

===

Expectation failed for method name is equal to 'getLanguages' when invoked 1 time(s)

Parameter 0 for invocation Wikibase\Repo\Hooks\Helpers\UserPreferredContentLanguagesLookup::getLanguages('ru', User Object (...)) does not match expected value.

Failed asserting that two strings are equal.

--- Expected

+++ Actual

@@ @@

-'en'

+'ru'

/home/travis/build/wikimedia/phase3/extensions/Wikibase/repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php:277

/home/travis/build/wikimedia/phase3/extensions/Wikibase/repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php:256

/home/travis/build/wikimedia/phase3/extensions/Wikibase/repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php:199

/home/travis/build/wikimedia/phase3/extensions/Wikibase/repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php:175

/home/travis/build/wikimedia/phase3/extensions/Wikibase/repo/tests/phpunit/includes/Hooks/OutputPageBeforeHTMLHookHandlerTest.php:142

/home/travis/build/wikimedia/phase3/maintenance/doMaintenance.php:99

The test was introduced in https://gerrit.wikimedia.org/r/531938, made for T227083

Event Timeline

Looks like this is because the tests create a real OutputPage object who's language is derived from the RequestContext.

Two

Change 534411 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] OutputPageBeforeHtmlHookHandlerTest mock RequestContext

https://gerrit.wikimedia.org/r/534411

Change 534411 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] OutputPageBeforeHtmlHookHandlerTest mock RequestContext

https://gerrit.wikimedia.org/r/534411