https://bugzilla.wikimedia.org/show_bug.cgi?id=68231
Bug ID: 68231 Summary: wfWikiID() returns different values from test and data provider Product: MediaWiki Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: Unit tests Assignee: wikibugs-l@lists.wikimedia.org Reporter: bda...@wikimedia.org CC: has...@free.fr, krinklem...@gmail.com, m...@everybody.org Web browser: --- Mobile Platform: --- This fails when running a test that extends CentralAuthTestCaseUsingDatabase: /** * @dataProvider provideWfWikiID */ public function testWfWikiID($expect) { $this->assertSame( $expect, wfWikiID() ); } public function provideWfWikiID() { return array( array( wfWikiID() ), ); } CentralAuthPluginUsingDatabaseTest::testWfWikiID with data set #0 ('wiki') Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -wiki +wiki-unittest_ I tried to use $this->dbPrefix() inside the provider to kludge the right value and got a failure with this stacktrace which might help figure out where we could initialize $wgDBprefix to get consistent behavior: Fatal error: Call to a member function getType() on a non-object in /vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php on line 400 Call Stack: 0.0008 253704 1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0 0.2053 8666952 2. MediaWikiPHPUnitCommand::main() /vagrant/mediawiki/tests/phpunit/phpunit.php:160 0.2053 8680808 3. PHPUnit_TextUI_Command->run() /vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42 0.2263 9419016 4. PHPUnit_Runner_BaseTestRunner->getTest() /vagrant/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:153 0.2502 11030928 5. PHPUnit_Framework_TestSuite->__construct() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:138 0.2587 11389784 6. PHPUnit_Framework_TestSuite->addTestMethod() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:219 0.2588 11390232 7. PHPUnit_Framework_TestSuite::createTest() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:800 0.2590 11394056 8. PHPUnit_Util_Test::getProvidedData() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:472 0.2591 11398136 9. ReflectionMethod->invoke() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Test.php:377 0.2591 11398208 10. CentralAuthPluginUsingDatabaseTest->provideAuthenticateWithPreRenameUsername() /vagrant/mediawiki/vendor/phpunit/phpunit/src/Util/Test.php:377 0.2592 11398320 11. MediaWikiTestCase->dbPrefix() /vagrant/mediawiki/extensions/CentralAuth/tests/CentralAuthPluginUsingDatabaseTest.php:205 -- You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l