Skip to content

Commit 8b1d769

Browse files
committed
Merge pull request #106 from magento-ogre/develop
[Ogre] Sprint 23 Contribution
2 parents 8e14d42 + d9b9467 commit 8b1d769

File tree

128 files changed

+1606
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1606
-323
lines changed

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ module.exports = function (grunt) {
3535
tmpSource: 'var/view_preprocessed/source/',
3636
tmp: 'var',
3737
css: {
38-
setup: 'setup/pub/magento/setup/css'
38+
setup: 'setup/pub/styles'
3939
},
4040
less: {
41-
setup: 'setup/module/Magento/Setup/styles'
41+
setup: 'setup/view/styles'
4242
},
4343
uglify: {
4444
legacy: 'lib/web/legacy-build.min.js'

app/code/Magento/CatalogSearch/view/frontend/templates/advanced/link.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ $helper = $this->helper('Magento\CatalogSearch\Helper\Data');
1111
?>
1212
<div class="nested">
1313
<a class="action advanced" href="<?php echo $helper->getAdvancedSearchUrl(); ?>">
14-
<?php echo __('Advanced Search (Modified Again)'); ?>
14+
<?php echo __('Advanced Search'); ?>
1515
</a>
1616
</div>

app/design/frontend/Magento/luma/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"map": [
1818
[
1919
"*",
20-
"Magento/luma"
20+
"frontend/Magento/luma"
2121
]
2222
]
2323
}

app/etc/di.xml

100644100755
File mode changed.

app/etc/vendor_path.php

100644100755
File mode changed.

dev/tests/functional/tests/app/Magento/Install/Test/Block/CustomizeStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CustomizeStore extends Form
2121
*
2222
* @var string
2323
*/
24-
protected $next = "[ng-click*='next']";
24+
protected $next = "[ng-click*='checkModuleConstraints']";
2525

2626
/**
2727
* First field selector

dev/tests/integration/testsuite/Magento/Setup/Model/ObjectManagerFactoryTest.php

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Setup\Model;
8+
9+
use Magento\Setup\Mvc\Bootstrap\InitParamListener;
10+
11+
class ObjectManagerProviderTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var ObjectManagerProvider
15+
*/
16+
private $object;
17+
18+
/**
19+
* @var \Zend\ServiceManager\ServiceLocatorInterface|\PHPUnit_Framework_MockObject_MockObject
20+
*/
21+
private $locator;
22+
23+
/**
24+
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
25+
*/
26+
private $deploymentConfig;
27+
28+
protected function setUp()
29+
{
30+
$this->locator = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface');
31+
$this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);
32+
$this->object = new ObjectManagerProvider($this->locator, $this->deploymentConfig);
33+
}
34+
35+
public function testGet()
36+
{
37+
$this->locator->expects($this->once())->method('get')->with(InitParamListener::BOOTSTRAP_PARAM)->willReturn([]);
38+
$objectManager = $this->object->get();
39+
$this->assertInstanceOf('Magento\Framework\ObjectManagerInterface', $objectManager);
40+
$this->assertSame($objectManager, $this->object->get());
41+
}
42+
}

dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ Magento/Usps/Model/Carrier
128128
Magento/Dhl/Model
129129
Magento/Shipping/Model
130130
Magento/Ui
131-
setup
132131
Magento/Sales/Service/V1
133132
Magento/Sales/Api
134133
Magento/Sales/Spi

dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dev/tests/integration
77
dev/tests/performance
88
dev/tests/static
99
dev/tests/unit
10+
setup

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,29 @@ public function testCheckConflictWhenEnableModuleDifferentVersion()
141141
$conflictChecker->checkConflictsWhenEnableModules(['Vendor_C'])
142142
);
143143
}
144+
145+
public function testCheckConflictWhenEnableModuleDifferentVersionWithCurEnabledModules()
146+
{
147+
$moduleListMock = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false);
148+
$packageInfoMock = $this->getMock('Magento\Framework\Module\PackageInfo', [], [], '', false);
149+
$packageInfoMock->expects($this->any())
150+
->method('getConflict')
151+
->will($this->returnValueMap([
152+
['Vendor_A', []],
153+
['Vendor_B', []],
154+
['Vendor_C', ['Vendor_A' => '>=0.2,<0.3', 'Vendor_B' => '<0.4']]
155+
]));
156+
$packageInfoMock->expects($this->any())
157+
->method('getVersion')
158+
->will($this->returnValueMap([['Vendor_A', '0.2'], ['Vendor_B', '0.4']]));
159+
$packageInfoFactoryMock = $this->getMock('Magento\Framework\Module\PackageInfoFactory', [], [], '', false);
160+
$packageInfoFactoryMock->expects($this->once())
161+
->method('create')
162+
->will($this->returnValue($packageInfoMock));
163+
$conflictChecker = new ConflictChecker($moduleListMock, $packageInfoFactoryMock);
164+
$this->assertEquals(
165+
['Vendor_C' => ['Vendor_C conflicts with current Vendor_A version 0.2 (version should not be >=0.2,<0.3)']],
166+
$conflictChecker->checkConflictsWhenEnableModules(['Vendor_C'], ['Vendor_A', 'Vendor_B'])
167+
);
168+
}
144169
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function setUp()
6565
->method('load')
6666
->will($this->returnValue(['A' => [], 'B' => [], 'C' => [], 'D' => [], 'E' => []]));
6767
}
68+
6869
public function testCheckDependenciesWhenDisableModules()
6970
{
7071
$this->listMock
@@ -78,6 +79,15 @@ public function testCheckDependenciesWhenDisableModules()
7879
$this->assertEquals($expected, $actual);
7980
}
8081

82+
public function testCheckDependenciesWhenDisableModulesWithCurEnabledModules()
83+
{
84+
$this->checker = new DependencyChecker($this->listMock, $this->loaderMock, $this->packageInfoFactoryMock);
85+
86+
$actual = $this->checker->checkDependenciesWhenDisableModules(['B', 'D'], ['C', 'D', 'E']);
87+
$expected = ['B' => [], 'D' => []];
88+
$this->assertEquals($expected, $actual);
89+
}
90+
8191
public function testCheckDependenciesWhenEnableModules()
8292
{
8393
$this->listMock
@@ -92,4 +102,15 @@ public function testCheckDependenciesWhenEnableModules()
92102
];
93103
$this->assertEquals($expected, $actual);
94104
}
105+
106+
public function testCheckDependenciesWhenEnableModulesWithCurEnabledModules()
107+
{
108+
$this->checker = new DependencyChecker($this->listMock, $this->loaderMock, $this->packageInfoFactoryMock);
109+
$actual = $this->checker->checkDependenciesWhenEnableModules(['B', 'D'], ['C']);
110+
$expected = [
111+
'B' => ['A' => ['B', 'D', 'A'], 'E' => ['B', 'E']],
112+
'D' => ['A' => ['D', 'A'], 'E' => ['D', 'A', 'B', 'E']],
113+
];
114+
$this->assertEquals($expected, $actual);
115+
}
95116
}

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ public function testCheckConstraintsEnableAllowed()
6969
$this->dependencyChecker->expects($this->once())
7070
->method('checkDependenciesWhenEnableModules')
7171
->will($this->returnValue(['Module_Foo' => [], 'Module_Bar' => []]));
72-
$result = $this->object->checkConstraints(true, ['Module_Foo' => '', 'Module_Bar' => '']);
72+
$result = $this->object->checkConstraints(
73+
true,
74+
['Module_Foo' => '', 'Module_Bar' => ''],
75+
['Module_baz', 'Module_quz']
76+
);
7377
$this->assertEquals([], $result);
7478
}
7579

@@ -86,7 +90,7 @@ public function testCheckConstraintsEnableNotAllowed()
8690
'Module_Bar' => ['Module_Baz' => ['Module_Bar', 'Module_Baz']],
8791
]
8892
));
89-
$result = $this->object->checkConstraints(true, ['Module_Foo' => '', 'Module_Bar' => '']);
93+
$result = $this->object->checkConstraints(true, ['Module_Foo' => '', 'Module_Bar' => ''], [], false);
9094
$expect = [
9195
'Cannot enable Module_Foo, depending on disabled modules:',
9296
"Module_Baz: Module_Foo->Module_Baz",
@@ -100,6 +104,31 @@ public function testCheckConstraintsEnableNotAllowed()
100104
$this->assertEquals($expect, $result);
101105
}
102106

107+
public function testCheckConstraintsEnableNotAllowedWithPrettyMsg()
108+
{
109+
$this->conflictChecker->expects($this->once())
110+
->method('checkConflictsWhenEnableModules')
111+
->will($this->returnValue(['Module_Foo' => ['Module_Bar'], 'Module_Bar' => ['Module_Foo']]));
112+
$this->dependencyChecker->expects($this->once())
113+
->method('checkDependenciesWhenEnableModules')
114+
->will($this->returnValue(
115+
[
116+
'Module_Foo' => ['Module_Baz' => ['Module_Foo', 'Module_Baz']],
117+
'Module_Bar' => ['Module_Baz' => ['Module_Bar', 'Module_Baz']],
118+
]
119+
));
120+
$result = $this->object->checkConstraints(true, ['Module_Foo' => '', 'Module_Bar' => ''], [], true);
121+
$expect = [
122+
'Cannot enable Module_Foo',
123+
'Cannot enable Module_Bar',
124+
'Cannot enable Module_Foo, conflicting with other modules:',
125+
"Module_Bar",
126+
'Cannot enable Module_Bar, conflicting with other modules:',
127+
"Module_Foo",
128+
];
129+
$this->assertEquals($expect, $result);
130+
}
131+
103132
public function testCheckConstraintsDisableAllowed()
104133
{
105134
$this->dependencyChecker->expects($this->once())

dev/tests/unit/testsuite/Magento/Setup/Controller/ConsoleControllerTest.php

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Setup\Controller;
88

9+
use Magento\Framework\Module\DbVersionInfo;
910
use Magento\Setup\Model\UserConfigurationDataMapper as UserConfig;
1011

1112
class ConsoleControllerTest extends \PHPUnit_Framework_TestCase
@@ -83,16 +84,15 @@ public function setUp()
8384
$this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
8485

8586
$this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
86-
$objectManagerFactory = $this->getMock('Magento\Setup\Model\ObjectManagerFactory', [], [], '', false);
87-
$objectManagerFactory->expects($this->any())->method('create')->willReturn($this->objectManager);
87+
$objectManagerProvider = $this->getMock('Magento\Setup\Model\ObjectManagerProvider', [], [], '', false);
88+
$objectManagerProvider->expects($this->any())->method('get')->willReturn($this->objectManager);
8889

8990
$this->controller = new ConsoleController(
9091
$this->consoleLogger,
9192
$this->options,
9293
$installerFactory,
9394
$this->maintenanceMode,
94-
$objectManagerFactory,
95-
$objectManagerFactory
95+
$objectManagerProvider
9696
);
9797
$this->controller->setEvent($this->mvcEvent);
9898
$this->controller->dispatch($this->request, $response);
@@ -168,6 +168,80 @@ public function testUpdateAction()
168168
$this->controller->updateAction();
169169
}
170170

171+
/**
172+
* @param array $outdated
173+
* @param array $expected
174+
*
175+
* @dataProvider dbStatusActionDataProvider
176+
*/
177+
public function testDbStatusAction(array $outdated, array $expected)
178+
{
179+
$dbVersionInfo = $this->getMock('\Magento\Framework\Module\DbVersionInfo', [], [], '', false);
180+
$this->objectManager->expects($this->once())
181+
->method('get')
182+
->with('Magento\Framework\Module\DbVersionInfo')
183+
->will($this->returnValue($dbVersionInfo));
184+
$dbVersionInfo->expects($this->once())
185+
->method('getDbVersionErrors')
186+
->will($this->returnValue($outdated));
187+
foreach ($expected as $at => $message) {
188+
$this->consoleLogger->expects($this->at($at))
189+
->method('log')
190+
->with($this->matches($message));
191+
}
192+
$this->controller->dbStatusAction();
193+
}
194+
195+
/**
196+
* @return array
197+
*/
198+
public function dbStatusActionDataProvider()
199+
{
200+
return [
201+
'one outdated module' => [
202+
[[
203+
DbVersionInfo::KEY_MODULE => 'Module_One',
204+
DbVersionInfo::KEY_TYPE => 'schema',
205+
DbVersionInfo::KEY_CURRENT => '1.0.0',
206+
DbVersionInfo::KEY_REQUIRED => '1.0.1',
207+
]],
208+
[
209+
1 => '%wModule_One%wschema:%w1.0.0%w->%w1.0.1%w',
210+
2 => 'Run the "Update" command to update your DB schema and data'
211+
],
212+
],
213+
'no outdated modules' => [
214+
[],
215+
[0 => 'All modules are up to date'],
216+
],
217+
'one newer module' => [
218+
[[
219+
DbVersionInfo::KEY_MODULE => 'Module_One',
220+
DbVersionInfo::KEY_TYPE => 'schema',
221+
DbVersionInfo::KEY_CURRENT => '1.0.1',
222+
DbVersionInfo::KEY_REQUIRED => '1.0.0',
223+
]],
224+
[
225+
1 => '%wModule_One%wschema:%w1.0.1%w->%w1.0.0%w',
226+
2 => 'Some modules use code versions newer or older than the database. ' .
227+
'First update the module code, then run the "Update" command.'
228+
],
229+
],
230+
'one none module' => [
231+
[[
232+
DbVersionInfo::KEY_MODULE => 'Module_One',
233+
DbVersionInfo::KEY_TYPE => 'schema',
234+
DbVersionInfo::KEY_CURRENT => 'none',
235+
DbVersionInfo::KEY_REQUIRED => '1.0.0',
236+
]],
237+
[
238+
1 => '%wModule_One%wschema:%wnone%w->%w1.0.0%w',
239+
2 => 'Run the "Update" command to update your DB schema and data'
240+
],
241+
]
242+
];
243+
}
244+
171245
public function testInstallUserConfigAction()
172246
{
173247
$this->installer->expects($this->once())->method('installUserConfig')->with($this->parameters);

0 commit comments

Comments
 (0)