Page MenuHomePhabricator

MockHttpTrait fails the whole test suite instead of individual test
Closed, DeclinedPublic

Description

In case some tests are failing due to making real HTTP requests, the whole phpunit test suite execution crashes, and not individual test is failing. It makes it extremely difficult to figure out which individual test needs fixing.

Event Timeline

This shouldn't happen. Do you have steps to reproduce, or a stack trace to share?

Ok, I think there's nothing we can do here. This happened before I fixed EventBus extension which was subscribing to a lot of hooks and sending real HTTP requests, so the mock HTTP exception was happening from MediaWikiIntegrationTestCase->addCoreDBData - too early for PHPUnit to be correctly setup to report anything useful.

This is reproducible by attempting to run PHPUnit tests in MediaWiki-Vagrant with the eventbus role enabled (T270801).

mdh@Michaels-Mac-mini vagrant % vagrant roles enable eventbus --provision
mdh@Michaels-Mac-mini vagrant % vagrant ssh
vagrant@vagrant:~$ cd /vagrant/mediawiki/
vagrant@vagrant:/vagrant/mediawiki$ sudo -u www-data php tests/phpunit/phpunit.php --wiki wiki extensions/EventBus/

Result:

Using PHP 7.2.31-1+0~20200514.41+debian9~1.gbpe2a56b+wmf1
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

HTTP requests to http://eventgate.local.wmftest.net:8080/v1/events blocked. Use MockHttpTrait.