@JasonMortonNZ opened this Pull Request on September 29th 2021 Contributor


Issue: dev-2082

This PR updates a test helper class and the container factory to enable plugin sorting. This is required for cloud plugins.


@tsteur commented on September 29th 2021 Member

@JasonMortonNZ I just tested this and the tracking spam tests in cloud still didn't work for me.

I then noticed that when running eg ./console tests:run plugins/Cloud/tests/Integration/TrackingSpamPrevention/CachedIPRangeProviderTests.php the GLOBALS sort function is set correctly. This then launches a phpunit command /Users/.../vendor/bin/phpunit ../../plugins/Cloud/tests/Integration/TrackingSpamPrevention/CachedIPRangeProviderTests.php where then the GLOBALS from bootstrap.php is not defined. Only when I configure the PHPUnit/bootstrap.php to also load the $matomoDir/bootstraph.php then the tests pass for me.

diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index f74696e954..e4d75e6e17 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -25,6 +25,10 @@ if (!defined('PIWIK_INCLUDE_PATH')) {

+if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) {
+    require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';

Can you confirm this?

@JasonMortonNZ commented on September 30th 2021 Contributor

Can you confirm this?

Yes, I've just retested this and confirm the same. I have to require_once the bootstrap.php file in order for this to pass.

This Pull Request was closed on September 30th 2021
Powered by GitHub Issue Mirror