Page MenuHomePhabricator

Make payments phpunit tests pass under Docker
Open, LowPublic

Event Timeline

AndyRussG set the point value for this task to 1.
AndyRussG removed the point value for this task.

Change 636995 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] Lock down more settings in test config

https://gerrit.wikimedia.org/r/636995

Change 636995 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Lock down more settings in test config

https://gerrit.wikimedia.org/r/636995

Change 637238 had a related patch set uploaded (by AndyRussG; owner: AndyRussG):
[mediawiki/extensions/DonationInterface@master] Set $wgPaypalExpressGatewayEnabled to false for FormChooserTest

https://gerrit.wikimedia.org/r/637238

Looks like the error and failures were due to LocalSettings leaking into the tests... The attached patches isolate the tests by resetting the global variables whose values were leaking in.

BTW, any comments on possible changes to the LocalSettings provided in the fundraising-dev repo would be much appreciated! Thanks!!! :)

Hey @AndyRussG I'm still seeing one remaining test failure after applying your latest patch. It looks like this:

There was 1 failure:

1) DonationInterface_Adapter_GatewayAdapterTest::testGetFallbackFailPage
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'https://localhost:9001/index.php/Main_Page?uselang=en'
+'https://localhost:9001/index.php/Donate-error?uselang=en'

/var/www/html/extensions/DonationInterface/tests/phpunit/Adapter/GatewayAdapterTest.php:423
/var/www/html/tests/phpunit/MediaWikiIntegrationTestCase.php:446
/var/www/html/maintenance/doMaintenance.php:107
=== Logs generated by test case
[localisation] [debug] LocalisationCache using store LCStoreNull []
[localisation] [debug] LocalisationCache using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
===

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

Are you not seeing that one at your end?

Change 637238 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Set $wgPaypalExpressGatewayEnabled to false for FormChooserTest

https://gerrit.wikimedia.org/r/637238

Change 703258 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[mediawiki/extensions/DonationInterface@adyen] PHPUnit tests: reset globals and use salt in API tests

https://gerrit.wikimedia.org/r/703258

Change 703259 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[wikimedia/fundraising/dev@master] Remove a line in config/payments/LocalSettings.php so tests pass

https://gerrit.wikimedia.org/r/703259

In addition to the above patches, I pushed a change to config-private (4decd99938) which just comments out a lot of the config there. With all that, Payments tests do pass locally. Still, I feel this is a bit of a bandaid solution, since really tests shouldn't be affected by local config, and the settings in the private repo (though incomplete) were meant to mimic production as closely as possible, and it'd be nice to be able to fiddle with those as needed.

Also, I noticed TestConfiguration.php, which looks like the place to set config for tests, though recent patches have used calls to setMwGlobals() in test setup instead. Any thoughts on the best route forward on DI tests and config?

Thanks!!

Change 708645 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[mediawiki/extensions/DonationInterface@master] PHPUnit tests: reset globals and use salt in API tests

https://gerrit.wikimedia.org/r/708645

Change 703258 abandoned by AndyRussG:

[mediawiki/extensions/DonationInterface@adyen] PHPUnit tests: reset globals and use salt in API tests

Reason:

See equivalent patch on master branch

https://gerrit.wikimedia.org/r/703258

Change 703259 merged by AndyRussG:

[wikimedia/fundraising/dev@master] Remove a line in config/payments/LocalSettings.php so tests pass

https://gerrit.wikimedia.org/r/703259