diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-11-18 04:42:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 04:42:45 +0300 |
commit | 3a268b1ac8a2241433ee2f3b85c2377691a9db13 (patch) | |
tree | cb8ebdf207bf800a1e2ba72b0307ba27a07e2c03 /tests/PHPUnit/Integration/ReleaseCheckListTest.php | |
parent | 3dbf7f1a3eb76eae02c09bf7a8553780c3fef041 (diff) |
Do not allow uninstalling custom variables and provider for a while (#16734)
Diffstat (limited to 'tests/PHPUnit/Integration/ReleaseCheckListTest.php')
-rw-r--r-- | tests/PHPUnit/Integration/ReleaseCheckListTest.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php index 1b436ecd37..793bb40baa 100644 --- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php +++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php @@ -10,11 +10,14 @@ namespace Piwik\Tests\Integration; use Exception; use PHPUnit\Framework\TestCase; +use Piwik\Application\Kernel\PluginList; use Piwik\AssetManager\UIAssetFetcher; use Piwik\Config; use Piwik\Container\StaticContainer; use Piwik\Filesystem; use Matomo\Ini\IniReader; +use Piwik\Http; +use Piwik\Plugin; use Piwik\Plugin\Manager; use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tracker; @@ -39,6 +42,26 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase parent::setUp(); } + public function test_CustomVariablesAndProviderPluginCanBeUninstalledOnceNoLongerIncludedInPackage() + { + $pluginsToTest = ['CustomVariables', 'Provider']; + + $pluginManager = Plugin\Manager::getInstance(); + + $package = Http::sendHttpRequest('https://raw.githubusercontent.com/matomo-org/matomo-package/master/scripts/build-package.sh', 20); + + foreach ($pluginsToTest as $pluginToTest) { + $isPluginBundledWithCore = $pluginManager->isPluginBundledWithCore($pluginToTest); + $isPluginIncludedInBuildZip = strpos($package, 'plugins/' . $pluginToTest) !== false; + + if ($isPluginBundledWithCore xor $isPluginIncludedInBuildZip) { + throw new Exception('Expected that when plugin can be uninstalled (is not included in core), then the plugin is also included in the build-package.sh so it is included in the release zip. Once we no longer include this plugin in build.zip then we need to allow uninstalling these plugins by changing isPluginBundledWithCore method. Plugin is ' . $pluginToTest); + } + } + + $this->assertNotEmpty($isPluginBundledWithCore, 'We expect at least one plugin to be checked in this test, otherwise we can remove this test once they are no longer included in core'); + } + public function test_TestCaseHasSetGroupsMethod() { // refs https://github.com/matomo-org/matomo/pull/16615 ensures setGroups method still exists in phpunit @@ -643,7 +666,7 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase $numTestedCorePlugins = 0; // eg these plugins are managed in a submodule and they are installing all tables/columns as part of their plugin install method etc. - $corePluginsThatAreIndependent = array('TagManager'); + $corePluginsThatAreIndependent = array('TagManager', 'Provider', 'CustomVariables'); foreach ($plugins as $pluginName => $info) { if ($manager->isPluginBundledWithCore($pluginName) && !in_array($pluginName, $corePluginsThatAreIndependent)) { |