Page MenuHomePhabricator

PageImagesTest::testGivenNonExistingPageOnBeforePageDisplayDoesNotAddMeta: Call to a member function response() on null
Closed, ResolvedPublic

Description

This is popping up on GrowthExperiments patches:

11:15:07 There was 1 error:
11:15:07 
11:15:07 1) PageImages\Tests\PageImagesTest::testGivenNonExistingPageOnBeforePageDisplayDoesNotAddMeta
11:15:07 === Logs generated by test case
11:15:07 [objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
11:15:07 [localisation] [debug] LocalisationCache: using store LCStoreNull []
11:15:07 ===
11:15:07 Error: Call to a member function response() on null
11:15:07 
11:15:07 /workspace/src/includes/OutputPage.php:341
11:15:07 /workspace/src/extensions/PageImages/tests/phpunit/PageImagesTest.php:51
11:15:07 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:434
11:15:07 /workspace/src/maintenance/doMaintenance.php:99

Not related to any specific change, as shown by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/546655.
No changes in PageImages recently, and core and other extension patches do not seem affected (maybe GrowthExperiments specifically pulls in PageImages tests in CI and most other repos don't?).

Event Timeline

Looks like it was caused by 67ea4f5 . When mocking OutputPage without disabling the constructor you'll need to also mock calls to getConfig and getRequest methods.

Change 546907 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/PageImages@master] Tests: Stub getRequest/getConfig for OutputPage mock

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

Looks like it was caused by 67ea4f5 . When mocking OutputPage without disabling the constructor you'll need to also mock calls to getConfig and getRequest methods.

Alternatively, with mockbuilder you can call methods method to only mock specific methods

Change 546907 merged by jenkins-bot:
[mediawiki/extensions/PageImages@master] Tests: Stub getRequest/getConfig for OutputPage mock

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

kostajh claimed this task.

Looks like it was caused by 67ea4f5 . When mocking OutputPage without disabling the constructor you'll need to also mock calls to getConfig and getRequest methods.

Argh, sorry, didn't catch that. Thanks for fixing.