Skip to content

Commit d3c8656

Browse files
committed
magento#11363: Merge branch '2.2-develop' of github.com:magento/magento2ce into MAGETWO-81594-PR-11363
2 parents 08696e3 + 08ec8ce commit d3c8656

File tree

22 files changed

+284
-46
lines changed

22 files changed

+284
-46
lines changed

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<div class="messages">
8686
<div class="message message-notice notice">
8787
<span
88-
translate="'Search strings are either normal strings or regular exceptions (PCRE). They are matched in the same order as entered.'"></span>
88+
translate="'Search strings are either normal strings or regular expressions (PCRE). They are matched in the same order as entered.'"></span>
8989
<br>
9090
<span
9191
translate="'Examples'"></span>:

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ define([
1212
'Magento_Checkout/js/model/payment/method-converter',
1313
'Magento_Checkout/js/model/error-processor',
1414
'Magento_Checkout/js/model/full-screen-loader',
15-
'Magento_Checkout/js/action/select-billing-address'
15+
'Magento_Checkout/js/action/select-billing-address',
16+
'Magento_Checkout/js/model/shipping-save-processor/payload-extender'
1617
], function (
1718
ko,
1819
quote,
@@ -22,7 +23,8 @@ define([
2223
methodConverter,
2324
errorProcessor,
2425
fullScreenLoader,
25-
selectBillingAddressAction
26+
selectBillingAddressAction,
27+
payloadExtender
2628
) {
2729
'use strict';
2830

@@ -46,6 +48,8 @@ define([
4648
}
4749
};
4850

51+
payloadExtender(payload);
52+
4953
fullScreenLoader.startLoader();
5054

5155
return storage.post(
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define(function () {
6+
'use strict';
7+
8+
return function (payload) {
9+
payload.addressInformation['extension_attributes'] = {};
10+
11+
return payload;
12+
};
13+
});

app/code/Magento/Cms/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Block,Block
133133
"Enable Page","Enable Page"
134134
Content,Content
135135
"Content Heading","Content Heading"
136-
"Search Engine Optimisation","Search Engine Optimisation"
136+
"Search Engine Optimization","Search Engine Optimization"
137137
"Meta Title","Meta Title"
138138
"Meta Keywords","Meta Keywords"
139139
"Meta Description","Meta Description"

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
<fieldset name="search_engine_optimisation" sortOrder="20">
142142
<settings>
143143
<collapsible>true</collapsible>
144-
<label translate="true">Search Engine Optimisation</label>
144+
<label translate="true">Search Engine Optimization</label>
145145
</settings>
146146
<field name="identifier" formElement="input">
147147
<argument name="data" xsi:type="array">

app/code/Magento/Cron/Model/Schedule.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
namespace Magento\Cron\Model;
88

99
use Magento\Framework\Exception\CronException;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1012

1113
/**
1214
* Crontab schedule model
@@ -43,21 +45,29 @@ class Schedule extends \Magento\Framework\Model\AbstractModel
4345

4446
const STATUS_ERROR = 'error';
4547

48+
/**
49+
* @var TimezoneInterface
50+
*/
51+
private $timezoneConverter;
52+
4653
/**
4754
* @param \Magento\Framework\Model\Context $context
4855
* @param \Magento\Framework\Registry $registry
4956
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
5057
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
5158
* @param array $data
59+
* @param TimezoneInterface $timezoneConverter
5260
*/
5361
public function __construct(
5462
\Magento\Framework\Model\Context $context,
5563
\Magento\Framework\Registry $registry,
5664
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
5765
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
58-
array $data = []
66+
array $data = [],
67+
TimezoneInterface $timezoneConverter = null
5968
) {
6069
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
70+
$this->timezoneConverter = $timezoneConverter ?: ObjectManager::getInstance()->get(TimezoneInterface::class);
6171
}
6272

6373
/**
@@ -100,6 +110,9 @@ public function trySchedule()
100110
return false;
101111
}
102112
if (!is_numeric($time)) {
113+
//convert time from UTC to admin store timezone
114+
//we assume that all schedules in configuration (crontab.xml and DB tables) are in admin store timezone
115+
$time = $this->timezoneConverter->date($time)->format('Y-m-d H:i');
103116
$time = strtotime($time);
104117
}
105118
$match = $this->matchCronExpression($e[0], strftime('%M', $time))

app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*/
1414
class ScheduleTest extends \PHPUnit\Framework\TestCase
1515
{
16+
/**
17+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
18+
*/
1619
protected $helper;
1720

1821
protected $resourceJobMock;
@@ -174,6 +177,35 @@ public function testTrySchedule($scheduledAt, $cronExprArr, $expected)
174177
$this->assertEquals($expected, $result);
175178
}
176179

180+
public function testTryScheduleWithConversionToAdminStoreTime()
181+
{
182+
$scheduledAt = '2011-12-13 14:15:16';
183+
$cronExprArr = ['*', '*', '*', '*', '*'];
184+
185+
// 1. Create mocks
186+
$timezoneConverter = $this->createMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
187+
$timezoneConverter->expects($this->once())
188+
->method('date')
189+
->with($scheduledAt)
190+
->willReturn(new \DateTime($scheduledAt));
191+
192+
/** @var \Magento\Cron\Model\Schedule $model */
193+
$model = $this->helper->getObject(
194+
\Magento\Cron\Model\Schedule::class,
195+
['timezoneConverter' => $timezoneConverter]
196+
);
197+
198+
// 2. Set fixtures
199+
$model->setScheduledAt($scheduledAt);
200+
$model->setCronExprArr($cronExprArr);
201+
202+
// 3. Run tested method
203+
$result = $model->trySchedule();
204+
205+
// 4. Compare actual result with expected result
206+
$this->assertTrue($result);
207+
}
208+
177209
/**
178210
* @return array
179211
*/
@@ -187,7 +219,6 @@ public function tryScheduleDataProvider()
187219
[$date, [], false],
188220
[$date, null, false],
189221
[$date, false, false],
190-
[$date, ['*', '*', '*', '*', '*'], true],
191222
[strtotime($date), ['*', '*', '*', '*', '*'], true],
192223
[strtotime($date), ['15', '*', '*', '*', '*'], true],
193224
[strtotime($date), ['*', '14', '*', '*', '*'], true],

app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
</settings>
1414
<container name="google_experiment_container" sortOrder="250">
1515
<htmlContent name="html_content">
16-
<block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage" />
16+
<block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage">
17+
<arguments>
18+
<argument name="code-entity" xsi:type="string">Magento\GoogleOptimizer\Block\Adminhtml\Cms\Page\EntityCmsPage</argument>
19+
<argument name="form-name" xsi:type="string">cms_page_form</argument>
20+
</arguments>
21+
</block>
1722
</htmlContent>
1823
</container>
1924
</fieldset>

app/code/Magento/Indexer/Model/Indexer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ public function reindexAll()
418418
$state->save();
419419
$this->getView()->resume();
420420
throw $exception;
421+
} catch (\Error $error) {
422+
$state->setStatus(StateInterface::STATUS_INVALID);
423+
$state->save();
424+
$this->getView()->resume();
425+
throw $error;
421426
}
422427
}
423428
}

app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,56 @@ function () {
273273
$this->model->reindexAll();
274274
}
275275

276+
/**
277+
* @expectedException \Error
278+
* @expectedExceptionMessage Test Engine Error
279+
*/
280+
public function testReindexAllWithError()
281+
{
282+
283+
$indexId = 'indexer_internal_name';
284+
$this->loadIndexer($indexId);
285+
286+
$stateMock = $this->createPartialMock(
287+
\Magento\Indexer\Model\Indexer\State::class,
288+
['load', 'getId', 'setIndexerId', '__wakeup', 'getStatus', 'setStatus', 'save']
289+
);
290+
$stateMock->expects($this->once())->method('load')->with($indexId, 'indexer_id')->will($this->returnSelf());
291+
$stateMock->expects($this->never())->method('setIndexerId');
292+
$stateMock->expects($this->once())->method('getId')->will($this->returnValue(1));
293+
$stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf());
294+
$stateMock->expects($this->once())->method('getStatus')->will($this->returnValue('idle'));
295+
$stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf());
296+
$this->stateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($stateMock));
297+
298+
$this->viewMock->expects($this->once())->method('isEnabled')->will($this->returnValue(false));
299+
$this->viewMock->expects($this->never())->method('suspend');
300+
$this->viewMock->expects($this->once())->method('resume');
301+
302+
$actionMock = $this->createPartialMock(
303+
\Magento\Framework\Indexer\ActionInterface::class,
304+
['executeFull', 'executeList', 'executeRow']
305+
);
306+
$actionMock->expects($this->once())->method('executeFull')->will(
307+
$this->returnCallback(
308+
function () {
309+
throw new \Error('Test Engine Error');
310+
}
311+
)
312+
);
313+
$this->actionFactoryMock->expects(
314+
$this->once()
315+
)->method(
316+
'create'
317+
)->with(
318+
'Some\Class\Name'
319+
)->will(
320+
$this->returnValue($actionMock)
321+
);
322+
323+
$this->model->reindexAll();
324+
}
325+
276326
protected function getIndexerData()
277327
{
278328
return [

0 commit comments

Comments
 (0)