Skip to content

Commit eb34df1

Browse files
eddielauOlga Kopylova
authored andcommitted
MAGETWO-33157: Conflict restriction checking is missing version checking in enable/disable module CLI
- rephrased error message
1 parent 3a7c067 commit eb34df1

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

dev/tests/unit/testsuite/Magento/Framework/Module/ConflictCheckerTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function checkConflictWhenEnableModuleDataProvider()
4949
[['Vendor_A', ['Vendor_B' => '0.1']], ['Vendor_B', []]],
5050
['Vendor_A'],
5151
['Vendor_B'],
52-
['Vendor_B' => ['Vendor_A conflicts with Vendor_B version 0.1 (current 0.1)']]
52+
['Vendor_B' => ['Vendor_A conflicts with current Vendor_B version 0.1 (version should not be 0.1)']]
5353
],
5454
[
5555
[['Vendor_A', ['Vendor_B' => '0.1']], ['Vendor_B', []]],
@@ -61,7 +61,7 @@ public function checkConflictWhenEnableModuleDataProvider()
6161
[['Vendor_B', ['Vendor_A' => '0.1']], ['Vendor_A', []]],
6262
['Vendor_A'],
6363
['Vendor_B'],
64-
['Vendor_B' => ['Vendor_B conflicts with Vendor_A version 0.1 (current 0.1)']]
64+
['Vendor_B' => ['Vendor_B conflicts with current Vendor_A version 0.1 (version should not be 0.1)']]
6565
],
6666
[
6767
[['Vendor_B', ['Vendor_A' => '0.1']], ['Vendor_A', []]],
@@ -85,28 +85,31 @@ public function checkConflictWhenEnableModuleDataProvider()
8585
[['Vendor_A', ['Vendor_C' => '0.1']], ['Vendor_B', []], ['Vendor_C', []]],
8686
['Vendor_A'],
8787
['Vendor_B', 'Vendor_C'],
88-
['Vendor_B' => [], 'Vendor_C' => ['Vendor_A conflicts with Vendor_C version 0.1 (current 0.1)']]
88+
[
89+
'Vendor_B' => [],
90+
'Vendor_C' => ['Vendor_A conflicts with current Vendor_C version 0.1 (version should not be 0.1)']
91+
]
8992
],
9093
[
9194
[['Vendor_A', []], ['Vendor_B', ['Vendor_C' => '0.1']], ['Vendor_C', []]],
9295
['Vendor_A'],
9396
['Vendor_B', 'Vendor_C'],
9497
[
95-
'Vendor_B' => ['Vendor_B conflicts with Vendor_C version 0.1 (current 0.1)'],
96-
'Vendor_C' => ['Vendor_B conflicts with Vendor_C version 0.1 (current 0.1)']
98+
'Vendor_B' => ['Vendor_B conflicts with current Vendor_C version 0.1 (version should not be 0.1)'],
99+
'Vendor_C' => ['Vendor_B conflicts with current Vendor_C version 0.1 (version should not be 0.1)']
97100
]
98101
],
99102
[
100103
[['Vendor_A', ['Vendor_B' => '>=0.1']], ['Vendor_B', []]],
101104
['Vendor_A'],
102105
['Vendor_B'],
103-
['Vendor_B' => ['Vendor_A conflicts with Vendor_B version >=0.1 (current 0.1)']]
106+
['Vendor_B' => ['Vendor_A conflicts with current Vendor_B version 0.1 (version should not be >=0.1)']]
104107
],
105108
[
106109
[['Vendor_A', ['Vendor_B' => '~0.1']], ['Vendor_B', []]],
107110
['Vendor_A'],
108111
['Vendor_B'],
109-
['Vendor_B' => ['Vendor_A conflicts with Vendor_B version ~0.1 (current 0.1)']]
112+
['Vendor_B' => ['Vendor_A conflicts with current Vendor_B version 0.1 (version should not be ~0.1)']]
110113
],
111114
];
112115
}
@@ -134,7 +137,7 @@ public function testCheckConflictWhenEnableModuleDifferentVersion()
134137
->will($this->returnValue($packageInfoMock));
135138
$conflictChecker = new ConflictChecker($moduleListMock, $packageInfoFactoryMock);
136139
$this->assertEquals(
137-
['Vendor_C' => ['Vendor_C conflicts with Vendor_A version >=0.2,<0.3 (current 0.2)']],
140+
['Vendor_C' => ['Vendor_C conflicts with current Vendor_A version 0.2 (version should not be >=0.2,<0.3)']],
138141
$conflictChecker->checkConflictsWhenEnableModules(['Vendor_C'])
139142
);
140143
}

lib/internal/Magento/Framework/Module/ConflictChecker.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ private function getConflictMessages($moduleA, $moduleB)
8080
$constraintA = $versionParser->parseConstraints($this->packageInfo->getConflict($moduleB)[$moduleA]);
8181
$constraintB = $versionParser->parseConstraints($this->packageInfo->getVersion($moduleA));
8282
if ($constraintA->matches($constraintB)) {
83-
$messages[] = "$moduleB conflicts with $moduleA version " .
84-
$this->packageInfo->getConflict($moduleB)[$moduleA] .
85-
' (current ' . $this->packageInfo->getVersion($moduleA) . ')';
83+
$messages[] = "$moduleB conflicts with current $moduleA version " .
84+
$this->packageInfo->getVersion($moduleA) .
85+
' (version should not be ' . $this->packageInfo->getConflict($moduleB)[$moduleA] . ')';
8686
}
8787
}
8888
if (isset($this->packageInfo->getConflict($moduleA)[$moduleB]) &&
@@ -92,9 +92,9 @@ private function getConflictMessages($moduleA, $moduleB)
9292
$constraintA = $versionParser->parseConstraints($this->packageInfo->getConflict($moduleA)[$moduleB]);
9393
$constraintB = $versionParser->parseConstraints($this->packageInfo->getVersion($moduleB));
9494
if ($constraintA->matches($constraintB)) {
95-
$messages[] = "$moduleA conflicts with $moduleB version " .
96-
$this->packageInfo->getConflict($moduleA)[$moduleB] .
97-
' (current ' . $this->packageInfo->getVersion($moduleA) . ')';;
95+
$messages[] = "$moduleA conflicts with current $moduleB version " .
96+
$this->packageInfo->getVersion($moduleA) .
97+
' (version should not be ' . $this->packageInfo->getConflict($moduleA)[$moduleB] . ')';;
9898
}
9999
}
100100
return $messages;

0 commit comments

Comments
 (0)