Skip to content

Commit feeadbe

Browse files
authored
Merge pull request #218 from magento-falcons/MAGETWO-56252
[Falcons] Delivery of bugfixes
2 parents 9485e36 + b166c67 commit feeadbe

File tree

13 files changed

+198
-122
lines changed

13 files changed

+198
-122
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Quantity.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*/
66
namespace Magento\CatalogImportExport\Model\Import\Product\Validator;
77

8-
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
98
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
109

10+
/**
11+
* Class Quantity
12+
*/
1113
class Quantity extends AbstractImportValidator implements RowValidatorInterface
1214
{
1315
/**
@@ -24,7 +26,7 @@ public function init($context)
2426
public function isValid($value)
2527
{
2628
$this->_clearMessages();
27-
if (!empty($value['qty']) && (!is_numeric($value['qty']) || $value['qty'] < 0)) {
29+
if (!empty($value['qty']) && !is_numeric($value['qty'])) {
2830
$this->_addMessages(
2931
[
3032
sprintf(
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator;
7+
8+
use Magento\CatalogImportExport\Model\Import\Product;
9+
use Magento\CatalogImportExport\Model\Import\Product\Validator\Quantity;
10+
11+
/**
12+
* Class QuantityTest
13+
*/
14+
class QuantityTest extends \PHPUnit_Framework_TestCase
15+
{
16+
/**
17+
* @var Quantity
18+
*/
19+
private $quantity;
20+
21+
protected function setUp()
22+
{
23+
$this->quantity = new Quantity();
24+
25+
$contextStub = $this->getMockBuilder(Product::class)
26+
->disableOriginalConstructor()
27+
->getMock();
28+
$contextStub->method('retrieveMessageTemplate')->willReturn(null);
29+
$this->quantity->init($contextStub);
30+
}
31+
32+
/**
33+
* @param bool $expectedResult
34+
* @param array $value
35+
* @dataProvider isValidDataProvider
36+
*/
37+
public function testIsValid($expectedResult, $value)
38+
{
39+
$result = $this->quantity->isValid($value);
40+
$this->assertEquals($expectedResult, $result);
41+
}
42+
43+
/**
44+
* @return array
45+
*/
46+
public function isValidDataProvider()
47+
{
48+
return [
49+
[true, ['qty' => 0]],
50+
[true, ['qty' => 1]],
51+
[true, ['qty' => 5]],
52+
[true, ['qty' => -1]],
53+
[true, ['qty' => -10]],
54+
[true, ['qty' => '']],
55+
[false, ['qty' => 'abc']],
56+
[false, ['qty' => true]],
57+
];
58+
}
59+
}

setup/pub/magento/setup/main.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ main.controller('navigationController',
118118
mainState: {},
119119
states: [],
120120
titlesWithModuleName: ['enable', 'disable', 'update', 'uninstall'],
121+
isLoadedStates: false,
121122
load: function () {
122123
var self = this;
123124
return $http.get('index.php/navigation').success(function (data) {
@@ -129,19 +130,22 @@ main.controller('navigationController',
129130
data.titles[value] = data.titles[value] + $localStorage.moduleName;
130131
});
131132
$localStorage.titles = data.titles;
132-
data.nav.forEach(function (item) {
133-
app.stateProvider.state(item.id, item);
134-
if (item.default) {
135-
self.mainState = item;
136-
}
133+
if (self.isLoadedStates == false) {
134+
data.nav.forEach(function (item) {
135+
app.stateProvider.state(item.id, item);
136+
if (item.default) {
137+
self.mainState = item;
138+
}
137139

138-
if (currentState == item.url) {
139-
$state.go(item.id);
140-
isCurrentStateFound = true;
140+
if (currentState == item.url) {
141+
$state.go(item.id);
142+
isCurrentStateFound = true;
143+
}
144+
});
145+
if (!isCurrentStateFound) {
146+
$state.go(self.mainState.id);
141147
}
142-
});
143-
if (!isCurrentStateFound) {
144-
$state.go(self.mainState.id);
148+
self.isLoadedStates = true;
145149
}
146150
});
147151
},

setup/pub/magento/setup/module-grid.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ angular.module('module-grid', ['ngStorage'])
6262
$scope.enableDisable = function(type, component) {
6363
$localStorage.packages = [
6464
{
65-
name: component.moduleName
65+
name: component.moduleName,
66+
isComposerPackage: component.name !== 'unknown',
6667
}
6768
];
6869
titleService.setTitle(type, component.moduleName ? component.moduleName : component.name);

setup/pub/magento/setup/readiness-check.js

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ angular.module('readiness-check', [])
1515
++$scope.progressCounter;
1616
};
1717
$scope.componentDependency = {
18+
enabled: true,
1819
visible: false,
1920
processed: false,
2021
expanded: false,
@@ -31,6 +32,7 @@ angular.module('readiness-check', [])
3132
break;
3233
case 'enable':
3334
case 'disable':
35+
$scope.componentDependency.enabled = $localStorage.packages[0].isComposerPackage;
3436
$scope.dependencyUrl = 'index.php/dependency-check/enable-disable-dependency-check';
3537
if ($localStorage.packages) {
3638
$scope.componentDependency.packages = {
@@ -235,35 +237,44 @@ angular.module('readiness-check', [])
235237
$scope.requestFailedHandler($scope.cronScript);
236238
}
237239
};
238-
$scope.items['component-dependency'] = {
239-
url: $scope.dependencyUrl,
240-
params: $scope.componentDependency.packages,
241-
show: function() {
242-
$scope.startProgress();
243-
$scope.componentDependency.visible = true;
244-
},
245-
process: function(data) {
246-
$scope.componentDependency.processed = true;
247-
if (data.errorMessage) {
248-
data.errorMessage = $sce.trustAsHtml(data.errorMessage);
240+
if ($scope.componentDependency.enabled) {
241+
$scope.items['component-dependency'] = {
242+
url: $scope.dependencyUrl,
243+
params: $scope.componentDependency.packages,
244+
show: function() {
245+
$scope.startProgress();
246+
$scope.componentDependency.visible = true;
247+
},
248+
process: function(data) {
249+
$scope.componentDependency.processed = true;
250+
if (data.errorMessage) {
251+
data.errorMessage = $sce.trustAsHtml(data.errorMessage);
252+
}
253+
angular.extend($scope.componentDependency, data);
254+
$scope.updateOnProcessed($scope.componentDependency.responseType);
255+
$scope.stopProgress();
256+
},
257+
fail: function() {
258+
$scope.requestFailedHandler($scope.componentDependency);
249259
}
250-
angular.extend($scope.componentDependency, data);
251-
$scope.updateOnProcessed($scope.componentDependency.responseType);
252-
$scope.stopProgress();
253-
},
254-
fail: function() {
255-
$scope.requestFailedHandler($scope.componentDependency);
256-
}
257-
};
260+
};
261+
}
262+
258263
}
259264

260265
$scope.isCompleted = function() {
261266
return $scope.version.processed
262267
&& $scope.settings.processed
263268
&& $scope.extensions.processed
264269
&& ($scope.permissions.processed || ($scope.actionFrom === 'updater'))
265-
&& (($scope.cronScript.processed && $scope.componentDependency.processed && $scope.updater.processed)
266-
|| ($scope.actionFrom !== 'updater'));
270+
&& (
271+
(
272+
$scope.cronScript.processed
273+
&& ($scope.componentDependency.processed || !$scope.componentDependency.enabled)
274+
&& $scope.updater.processed
275+
)
276+
|| ($scope.actionFrom !== 'updater')
277+
);
267278
};
268279

269280
$scope.updateOnProcessed = function(value) {

setup/pub/magento/setup/select-version.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ angular.module('select-version', ['ngStorage'])
3737
$scope.versions = [];
3838
$scope.data = data;
3939
angular.forEach(data.packages, function (value, key) {
40-
if (value.stable) {
40+
if (value.stable && !value.current) {
4141
$scope.versions.push({
4242
'versionInfo': angular.toJson({
4343
'package': value.package,
4444
'version': value.id
4545
}),
4646
'version': value
4747
});
48+
} else if (value.stable && value.current) {
49+
$scope.currentVersion = value.name;
4850
}
4951
});
5052
$scope.selectedOption = $scope.versions[0].versionInfo;
@@ -158,7 +160,7 @@ angular.module('select-version', ['ngStorage'])
158160
$scope.selectedOption = [];
159161
$scope.versions = [];
160162
angular.forEach($scope.data.packages, function (value, key) {
161-
if (value.stable || $scope.showUnstable) {
163+
if ((value.stable || $scope.showUnstable) && !value.current) {
162164
$scope.versions.push({
163165
'versionInfo': angular.toJson({
164166
'package': value.package,

setup/pub/magento/setup/view/pagination.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<input id="pageCurrent"
1818
class="admin__control-text"
1919
type="number"
20-
value="{{$parent.currentPage}}"
20+
ng-value="$parent.currentPage"
2121
ng-model="$parent.currentPage"
2222
>
2323
<label class="admin__control-support-text" for="pageCurrent">
@@ -30,4 +30,4 @@
3030
>
3131
<span>Next page</span>
3232
</button>
33-
</div>
33+
</div>

0 commit comments

Comments
 (0)