Page MenuHomePhabricator

PHPUnit tests fail on clean cli install with SQLite
Closed, ResolvedPublic

Description

php phpunit.php --configuration /resources/nike/translatewiki/melange/mediawiki/tests/phpunit/suite.xml --exclude-group Broken,ParserFuzz,Destructive,Stub
PHPUnit 3.7.8 by Sebastian Bergmann.

Configuration read from /resources/nike/translatewiki/melange/mediawiki/tests/phpunit/suite.xml

A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT user_id FROM unittest_user WHERE user_name = 'UTSysop' LIMIT 1
Function: User::idForName
Error: 1 no such table: unittest_user

make: *** [safe] Error 1
twn:/resources/nike/translatewiki/melange/mediawiki/tests/phpunit (master)$ make safe
php phpunit.php --configuration /resources/nike/translatewiki/melange/mediawiki/tests/phpunit/suite.xml --exclude-group Broken,ParserFuzz,Destructive,Stub
PHPUnit 3.7.8 by Sebastian Bergmann.

Configuration read from /resources/nike/translatewiki/melange/mediawiki/tests/phpunit/suite.xml

A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: CREATE VIRTUAL TABLE "unittest_melange_searchindex" USING FTS3(
si_title,
si_text
)
Function: DatabaseSqlite::duplicateTableStructure
Error: 1 table "unittest_melange_searchindex" already exists

make: *** [safe] Error 1


Version: 1.21.x
Severity: major

Details

Reference
bz42529

Event Timeline

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

Brian just reported on IRC: Tests: 5307, Assertions: 497129, Failures: 11, Errors: 332, Incomplete: 3, Skipped: 17. I had to edit files just to make them not give a php fatal error.

I suggested: Maybe you, Niklas and Antoine should discuss this and devise a plan? I do know that Niklas keeps being annoyed about the tests not running reliably and/or consistently in his development environment, and we can really address this issue, I think.

by changing the user to www-data instead of my normal user, I got the errors down to about 282.

The original issue was:

Fatal error: Cannot redeclare class ParserTests in /var/www/w/git/tests/phpunit/includes/parser/MediaWikiParserTest.php(27) : eval()'d code on line 3

Which prevents unit tests from running. I'm running PHP 5.3.3-7

After getting it working by renaming MediaWikiParserTest.php to something without a php extension, I get _a lot_ of errors:

FAILURES!
Tests: 5307, Assertions: 446595, Failures: 18, Errors: 282, Incomplete: 3, Skipped: 17.

282 errors seems absurdly high...

And the errors are? Please attach a full log of your PHPUnit output :-]

Also consider running the unit test with a default LocalSettings.php as created with the installer.

(In reply to comment #3)

Also consider running the unit test with a default LocalSettings.php as
created
with the installer.

Doesn't that defeat the point of tests - if they suddenly stop working due to configuration?

Then that means the tests need to be improved :-] They should at least work with the default settings.

(In reply to comment #2)

by changing the user to www-data instead of my normal user, I got the errors
down to about 282.

The original issue was:

Fatal error: Cannot redeclare class ParserTests in
/var/www/w/git/tests/phpunit/includes/parser/MediaWikiParserTest.php(27) :
eval()'d code on line 3

Which prevents unit tests from running. I'm running PHP 5.3.3-7

This was due to bug 42174. I've submitted gerrit change 67098

Does this still happen with the current release/HEAD?

Assuming it got fixed somehow.