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:
authordiosmosis <diosmosis@users.noreply.github.com>2022-03-04 20:29:15 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2022-03-04 20:29:15 +0300
commite650e9768b74925397976008594205d89d58f1dc (patch)
tree87072a4a37e37413fa7d566ea9512b74295d442c
parentb774954679f99ef190b9ef71043529563f764946 (diff)
Fix regression in plugin order determination, new param keepUnresolved is not used in function.vue-plugin-order-regression
-rw-r--r--core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php1
-rw-r--r--tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php20
2 files changed, 21 insertions, 0 deletions
diff --git a/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php b/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php
index 64c7a0f4cb..d56283bbaa 100644
--- a/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php
+++ b/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php
@@ -230,6 +230,7 @@ class PluginUmdAssetFetcher extends UIAssetFetcher
// check if dependency is not activated
if (!in_array($pluginDependency, $plugins)
&& !in_array($pluginDependency, $result)
+ && !$keepUnresolved
) {
return;
}
diff --git a/tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php b/tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php
index 1346fa4bf1..f14708ba49 100644
--- a/tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php
+++ b/tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php
@@ -315,6 +315,26 @@ class PluginUmdAssetFetcherTest extends UnitTestCase
$this->assertEquals($expectedAssets, $assets);
}
+ public function test_orderPluginsByPluginDependencies()
+ {
+ $pluginList = PluginUmdAssetFetcher::orderPluginsByPluginDependencies([
+ 'TestPlugin4',
+ 'TestPlugin1',
+ 'TestPlugin2',
+ ]);
+ $this->assertEquals(['TestPlugin4', 'TestPlugin1', 'TestPlugin2'], $pluginList);
+ }
+
+ public function test_orderPluginsByPluginDependencies_whenKeepUnresolvedIsFalse()
+ {
+ $pluginList = PluginUmdAssetFetcher::orderPluginsByPluginDependencies([
+ 'TestPlugin4',
+ 'TestPlugin1',
+ 'TestPlugin2',
+ ], $keepUnresolved = false);
+ $this->assertEquals(['TestPlugin1', 'TestPlugin2'], $pluginList);
+ }
+
private static function getUmdFile(string $pluginName)
{
$relativeRoot = str_replace(PIWIK_INCLUDE_PATH, '', self::TEST_PLUGINS_DIR);