Page MenuHomePhabricator

PHPUnit test case warning about Special:Notifications missing aliases in SkinMinervaTest
Closed, DeclinedPublic

Description

Running phpunit tests on a vagrant wiki setup with MobileFrontend and various others extensions (but not Echo):

sudo -u www-data php tests/phpunit/phpunit.php --wiki wiki | tee test-results.txt
PHP Notice:  Did not find alias for special page 'Notifications'. Perhaps no aliases are defined for it? [Called from MediaWiki\Special\SpecialPageFactory::getLocalNameFor in /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php at line 695] in /vagrant/mediawiki/includes/debug/MWDebug.php on line 309
PHP Stack trace:
PHP   1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0
PHP   2. require() /vagrant/mediawiki/tests/phpunit/phpunit.php:174
PHP   3. PHPUnitMaintClass->execute() /vagrant/mediawiki/maintenance/doMaintenance.php:94
PHP   4. PHPUnit\TextUI\Command::main() /vagrant/mediawiki/tests/phpunit/phpunit.php:135
PHP   5. PHPUnit\TextUI\Command->run() /vagrant/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:148
PHP   6. PHPUnit\TextUI\Command->handleArguments() /vagrant/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:159
PHP   7. PHPUnit\Util\Configuration->getTestSuiteConfiguration() /vagrant/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:837
PHP   8. PHPUnit\Util\Configuration->getTestSuite() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Configuration.php:918
PHP   9. PHPUnit\Framework\TestSuite->addTestFile() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Configuration.php:1055
PHP  10. ReflectionMethod->invoke() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:374
PHP  11. ExtensionsTestSuite::suite() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:374
PHP  12. ExtensionsTestSuite->__construct() /vagrant/mediawiki/tests/phpunit/suites/ExtensionsTestSuite.php:39
PHP  13. PHPUnit\Framework\TestSuite->addTestFiles() /vagrant/mediawiki/tests/phpunit/suites/ExtensionsTestSuite.php:27
PHP  14. PHPUnit\Framework\TestSuite->addTestFile() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:403
PHP  15. PHPUnit\Framework\TestSuite->addTestSuite() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:377
PHP  16. PHPUnit\Framework\TestSuite->__construct() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:290
PHP  17. PHPUnit\Framework\TestSuite->addTestMethod() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:187
PHP  18. PHPUnit\Framework\TestSuite::createTest() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:882
PHP  19. PHPUnit\Util\Test::getProvidedData() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:482
PHP  20. PHPUnit\Util\Test::getDataFromDataProviderAnnotation() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Test.php:449
PHP  21. ReflectionMethod->invoke() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Test.php:521
PHP  22. Tests\MediaWiki\Minerva\SkinMinervaTest->providePrepareUserButton() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Test.php:521
PHP  23. Tests\MediaWiki\Minerva\SkinMinervaTest->providePrepareUserButtonEcho() /vagrant/mediawiki/skins/MinervaNeue/tests/phpunit/skins/SkinMinervaTest.php:438
PHP  24. Tests\MediaWiki\Minerva\SkinMinervaTest->getSecondaryButtonExpectedResult() /vagrant/mediawiki/skins/MinervaNeue/tests/phpunit/skins/SkinMinervaTest.php:333
PHP  25. SpecialPage::getTitleFor() /vagrant/mediawiki/skins/MinervaNeue/tests/phpunit/skins/SkinMinervaTest.php:300
PHP  26. SpecialPage::getTitleValueFor() /vagrant/mediawiki/includes/specialpage/SpecialPage.php:84
PHP  27. MediaWiki\Special\SpecialPageFactory->getLocalNameFor() /vagrant/mediawiki/includes/specialpage/SpecialPage.php:99
PHP  28. wfWarn() /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php:695
PHP  29. MWDebug::warning() /vagrant/mediawiki/includes/GlobalFunctions.php:1135
PHP  30. MWDebug::sendMessage() /vagrant/mediawiki/includes/debug/MWDebug.php:164
PHP  31. trigger_error() /vagrant/mediawiki/includes/debug/MWDebug.php:309

Developer notes / replication instructions

  • Make sure Echo and Thanks are disabled
  • Replicate via ~/git/core/tests/phpunit/phpunit.php tests/phpunit/skins/SkinMinervaTest.php
  • Any instances of SpecialPage::getTitleFor( 'Notifications' ) will fail when the special page is not registered.

We can detect whether Echo is installed with

ExtensionRegistry::getInstance()->isLoaded( 'Echo' )

Options

  1. Find a way to disable the test when Echo is not installed
  2. Mock the Title object where needed
  3. Make test behaviour depend on what's installed

Event Timeline

brion created this task.Aug 20 2018, 5:05 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 20 2018, 5:05 PM
Jdlrobson triaged this task as Low priority.Aug 22 2018, 5:19 PM
Aklapper updated the task description. (Show Details)Oct 5 2018, 7:38 PM

Had abandoned on GCI. Sorry :(

Shreyasminocha removed Shreyasminocha as the assignee of this task.Dec 13 2018, 8:58 PM
Shreyasminocha added a subscriber: Shreyasminocha.
Jdlrobson closed this task as Declined.Oct 8 2019, 3:13 PM
Jdlrobson raised the priority of this task from Low to Medium.
Jdlrobson added a subscriber: Jdlrobson.

Will be fixed as part of T226125