Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-04-15 23:22:26 +0300
committerGitHub <noreply@github.com>2020-04-15 23:22:26 +0300
commit97cf78a8a1365a9485597f2f24d1edb0becf099a (patch)
tree67f3de6ce9687e1d54636f02a5bf319acce388cf /tests/PHPUnit/Integration/ReleaseCheckListTest.php
parentc4eca98199cdf18a4cd969c5495be58a0c348b92 (diff)
Add test to ensure there are no plugin updates for core plugins (#15815)
Diffstat (limited to 'tests/PHPUnit/Integration/ReleaseCheckListTest.php')
-rw-r--r--tests/PHPUnit/Integration/ReleaseCheckListTest.php44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
index 690ef8e166..0be0deb0b7 100644
--- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
@@ -12,7 +12,6 @@ use Exception;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Filesystem;
-use Piwik\Http;
use Matomo\Ini\IniReader;
use Piwik\Plugin\Manager;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
@@ -617,6 +616,49 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
$this->assertGreaterThan($minimumTotalFilesizesExpectedInMb * 1024 * 1024, $sumFilesizes, "expected to have at least $minimumTotalFilesizesExpectedInMb Mb of files in Piwik codebase.");
}
+ public function test_noUpdatesInCorePlugins()
+ {
+ $manager = Manager::getInstance();
+ $plugins = $manager->loadAllPluginsAndGetTheirInfo();
+
+ $pluginsWithUnexpectedUpdates = array();
+ $pluginsWithUpdates = array();
+ $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');
+
+ foreach ($plugins as $pluginName => $info) {
+ if ($manager->isPluginBundledWithCore($pluginName) && !in_array($pluginName, $corePluginsThatAreIndependent)) {
+ $numTestedCorePlugins++;
+ $pathToUpdates = Manager::getPluginDirectory($pluginName) . '/Updates/*.php';
+ $files = _glob($pathToUpdates);
+ if (empty($files)) {
+ $files = array();
+ }
+
+ foreach ($files as $file) {
+ $fileVersion = basename($file, '.php');
+ if (
+ version_compare('3.13.0', $fileVersion) != 1
+ ) {
+ // since matomo 3.13.0 we basically don't want to see any plugin specific updates for core plugins
+ // they should be instead in core/Updates/*
+ $pluginsWithUnexpectedUpdates[$pluginName] = $file;
+ } else {
+ $pluginsWithUpdates[] = $pluginName;
+ }
+ }
+ }
+ }
+
+ $this->assertSame(array(), $pluginsWithUnexpectedUpdates);
+
+ // some assertions below to make sure we're actually doing valid tests and there is no bug in above code
+ $this->assertGreaterThan(50, $numTestedCorePlugins);
+ // eg this here shows the plugins that have update files but from older matomo versions.
+ $this->assertSame(array('DevicesDetection', 'ExamplePlugin', 'Goals', 'LanguagesManager'), array_unique($pluginsWithUpdates));
+ }
/**
* @param $file
* @return bool