Page MenuHomePhabricator

PHP unit tests don't work if not run from tests/phpunit directory - "Call to a member function numRows() on a non-object"
Closed, ResolvedPublic

Description

reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/core$ php tests/phpunit/phpunit.php
PHPUnit 3.7.28 by Sebastian Bergmann.

Configuration read from /var/www/wiki/mediawiki/core/tests/phpunit/suite.xml

...............................................EEEPHP Fatal error: Call to a member function numRows() on a non-object in /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php on line 512
PHP Stack trace:
PHP 1. {main}() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:0
PHP 2. MediaWikiPHPUnitCommand::main() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:119
PHP 3. MediaWikiPHPUnitCommand->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64
PHP 4. PHPUnit_TextUI_Command->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
PHP 5. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
PHP 6. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:349
PHP 7. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
PHP 8. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
PHP 9. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
PHP 10. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
PHP 11. MediaWikiTestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:775
PHP 12. PHPUnit_Framework_TestCase->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
PHP 13. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:783
PHP 14. PHP_Invoker->invoke() /usr/share/php/PHPUnit/Framework/TestResult.php:646
PHP 15. call_user_func_array() /usr/share/php/PHP/Invoker.php:93
PHP 16. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHP/Invoker.php:93
PHP 17. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:838
PHP 18. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:983
PHP 19. CollationTest->testGetFirstLetter() /usr/share/php/PHPUnit/Framework/TestCase.php:983
PHP 20. IcuCollation->getFirstLetter() /var/www/wiki/mediawiki/core/tests/phpunit/includes/CollationTest.php:94
PHP 21. IcuCollation->getFirstLetterCount() /var/www/wiki/mediawiki/core/includes/Collation.php:333
PHP 22. IcuCollation->getFirstLetterData() /var/www/wiki/mediawiki/core/includes/Collation.php:497
PHP 23. SqlBagOStuff->get() /var/www/wiki/mediawiki/core/includes/Collation.php:351
PHP 24. SqlBagOStuff->getMulti() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:200
PHP 25. SqlBagOStuff->garbageCollect() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:221
PHP 26. SqlBagOStuff->expireAll() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:478
PHP 27. SqlBagOStuff->deleteObjectsExpiringBefore() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:483

Fatal error: Call to a member function numRows() on a non-object in /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php on line 512

Call Stack:

 0.0009     245936   1. {main}() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:0
 2.1811   14020520   2. MediaWikiPHPUnitCommand::main() /var/www/wiki/mediawiki/core/tests/phpunit/phpunit.php:119
 2.1813   14032872   3. MediaWikiPHPUnitCommand->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64
 2.1813   14033352   4. PHPUnit_TextUI_Command->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
 7.9824   86568944   5. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
 7.9973   86890608   6. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:349
 8.1015   86892360   7. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
17.3521  113192856   8. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
17.3889  113253808   9. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:705
20.9046  115305016  10. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
20.9046  115305016  11. MediaWikiTestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:775
20.9046  115305168  12. PHPUnit_Framework_TestCase->run() /var/www/wiki/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
20.9047  115305168  13. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:783
20.9049  115306896  14. PHP_Invoker->invoke() /usr/share/php/PHPUnit/Framework/TestResult.php:646
20.9049  115306816  15. call_user_func_array() /usr/share/php/PHP/Invoker.php:93
20.9049  115306984  16. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHP/Invoker.php:93
20.9052  115324728  17. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:838
20.9052  115325840  18. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:983
20.9052  115325880  19. CollationTest->testGetFirstLetter() /usr/share/php/PHPUnit/Framework/TestCase.php:983
20.9054  115326360  20. IcuCollation->getFirstLetter() /var/www/wiki/mediawiki/core/tests/phpunit/includes/CollationTest.php:94
20.9056  115327080  21. IcuCollation->getFirstLetterCount() /var/www/wiki/mediawiki/core/includes/Collation.php:333
20.9056  115327080  22. IcuCollation->getFirstLetterData() /var/www/wiki/mediawiki/core/includes/Collation.php:497
20.9056  115327184  23. SqlBagOStuff->get() /var/www/wiki/mediawiki/core/includes/Collation.php:351
20.9056  115327536  24. SqlBagOStuff->getMulti() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:200
20.9056  115328648  25. SqlBagOStuff->garbageCollect() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:221
20.9057  115328736  26. SqlBagOStuff->expireAll() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:478
20.9058  115329352  27. SqlBagOStuff->deleteObjectsExpiringBefore() /var/www/wiki/mediawiki/core/includes/objectcache/SqlBagOStuff.php:483

Version: 1.23.0
Severity: normal

Details

Reference
bz56909

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:29 AM
bzimport set Reference to bz56909.
bzimport added a subscriber: Unknown Object (MLST).

This need to be bisected to find out which commit caused the issue. I am not sure which tests are failing exactly, could you rerun using --tap option i.e.:

php tests/phpunit/phpunit.php --tap

Bisecting to find the root cause would be a huge plus :-D

(In reply to Umherirrender from comment #3)

Maybe fixed by Gerrit change #141619

Now merged, should be fixed.

Could use the patch on REL1_23 since we will surely have that issue when running tests.

This isn't trivial to cherry pick. Was the problem in 1.23?

Sorry didn't mean to mark this "denied".

The merge conflict is with gerrit 146674, which was also the conflict on the first Code-Review+2. Add me as reviewer to the patch set, when the conflict should be resolved, or cherry-pick also that patch set.

Cherry-Picked to REL1_23: gerrit 154460