Page MenuHomePhabricator

[Task] add possibility to generate proper phpunit coverage reports of Wikibase.git
Open, MediumPublic

Description

Add possibility to generate proper (whitelisting files, strict) phpunit coverage reports of Wikibase.git .

Details

Reference
bz72318

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:53 AM
bzimport set Reference to bz72318.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

This is purely about configuration in the repo right? And not yet another self maintained coverage infrastructure that breaks every month and then stops working altogether?

On vagrant:

$ php5 tests/phpunit/phpunit.php --wiki wikidatawiki  --conf extensions/WikidataBuildResources/extensions/Wikibase/phpunit.xml.dist 
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/20-xhprof.ini on line 2 in Unknown on line 0
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="tests/bootstrap.php"
         cacheTokens="false"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         strict="true"
         verbose="true">
    <testsuites>
        <testsuite name="WikibaseTests">
            <directory>client/tests/phpunit</directory>
            <directory>lib/tests/phpunit</directory>
            <directory>repo/tests/phpunit</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">client/includes</directory>
            <directory suffix=".php">client/maintenance</directory>

            <directory suffix=".php">lib/includes</directory>
            <directory suffix=".php">lib/maintenance</directory>

            <directory suffix=".php">repo/includes</directory>
            <directory suffix=".php">repo/maintenance</directory>
        </whitelist>
    </filter>
</phpunit>

Loading composer repositories with package information
Updating dependencies (including require-dev)
...
Generating autoload files
PHPUnit 4.6.4 by Sebastian Bergmann and contributors.

Configuration read from /srv/vagrant/mediawiki/extensions/WikidataBuildResources/extensions/Wikibase/phpunit.xml.dist

Deprecated configuration setting "strict" used

..........DB connection error: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost)

This is probably related to T95899.

Using --exclude-group Database works with only 1 failure:

  1. Wikibase\Test\PropertyHandlerTest::testCanBeUsedOn

It should be possible to create this kind of entity in the respective entity namespace!
Failed asserting that false is true.

/home/jan/projects/wikimedia/mediawiki/extensions/Wikibase/repo/tests/phpunit/includes/content/EntityHandlerTest.php:160
/home/jan/projects/wikimedia/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:131


The first failing Database test is in client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php which gives a backtrace with HHVM:

Fatal error: Uncaught exception 'DBConnectionError' with message 'DB connection error: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost)' in /home/jan/projects/wikimedia/mediawiki/core/includes/db/Database.php:1018
Stack trace:
#0 /home/jan/projects/wikimedia/mediawiki/core/includes/db/LoadBalancer.php(809): DatabaseBase->reportConnectionError()
#1 /home/jan/projects/wikimedia/mediawiki/core/includes/db/LoadBalancer.php(511): LoadBalancer->reportConnectionError()
#2 /home/jan/projects/wikimedia/mediawiki/core/includes/GlobalFunctions.php(3600): LoadBalancer->getConnection()
#3 /home/jan/projects/wikimedia/mediawiki/core/tests/phpunit/MediaWikiTestCase.php(114): wfGetDB()
#4 /home/jan/projects/wikimedia/mediawiki/core/vendor/phpunit/phpunit/src/Framework/TestSuite.php(722): MediaWikiTestCase->run()
#5 /home/jan/projects/wikimedia/mediawiki/core/vendor/phpunit/phpunit/src/Framework/TestSuite.php(722): PHPUnit_Framework_TestSuite->run()
#6 /home/jan/projects/wikimedia/mediawiki/core/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(406): PHPUnit_Framework_TestSuite->run()
#7 /home/jan/projects/wikimedia/mediawiki/core/vendor/phpunit/phpunit/src/TextUI/Command.php(153): PHPUnit_TextUI_TestRunner->doRun()
#8 /home/jan/projects/wikimedia/mediawiki/core/vendor/phpunit/phpunit/src/TextUI/Command.php(105): PHPUnit_TextUI_Command->run()
#9 /home/jan/projects/wikimedia/mediawiki/core/tests/phpunit/phpunit.php(241): PHPUnit_TextUI_Command::main()
#10 {main}

It seems it is connecting to mysql even though my mediawiki installation is configured to use sqlite.

Deprecated configuration setting "strict" used

Someone told me that they got the API tests working in mediawiki-vagrant by disabling all roles besides "wikidata", hacking /vagrant/settings.d/wikis/CommonSettings.php to call MWMultiVersion::initializeForMaintenance() instead of MWMultiVersion::initializeForWiki() if MW_DB is defined, and then doing php /vagrant/mediawiki/tests/phpunit/phpunit.php --wiki wikidatawiki --group WikibaseAPI /vagrant/mediawiki/extensions/WikidataBuildResources/extensions/Wikibase.

Jonas renamed this task from add possibility to generate proper phpunit coverage reports of Wikibase.git to [Task] add possibility to generate proper phpunit coverage reports of Wikibase.git.Sep 10 2015, 2:38 PM
Jonas updated the task description. (Show Details)

See https://www.mediawiki.org/wiki/Continuous_integration/Tutorials/Generating_PHP_test_coverage_for_a_MediaWiki_extension for how to get this enabled for Wikibase. I believe this is currently blocked on the fact Wikibase is not following the standard directory layout of src/ or includes/.