Skip to content

Commit fcdcd81

Browse files
author
Stanislav Idolov
committed
MAGETWO-84756: Prepare codebase for 2.0.18
1 parent d0f33dc commit fcdcd81

File tree

133 files changed

+2727
-1412
lines changed

Some content is hidden

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

133 files changed

+2727
-1412
lines changed

.htaccess

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ DirectoryIndex index.php
4646
order allow,deny
4747
deny from all
4848
</Files>
49+
<Files auth.json>
50+
order allow,deny
51+
deny from all
52+
</Files>
4953
<Files .gitignore>
5054
order allow,deny
5155
deny from all

.htaccess.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ DirectoryIndex index.php
210210
order allow,deny
211211
deny from all
212212
</Files>
213+
<Files auth.json>
214+
order allow,deny
215+
deny from all
216+
</Files>
213217
<Files .gitignore>
214218
order allow,deny
215219
deny from all

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ matrix:
3030
- php: 5.6
3131
env: TEST_SUITE=static_annotation
3232
before_install:
33+
# Workaround for the MongoDB GPG key expiry
34+
- sudo rm /etc/apt/sources.list.d/mongodb-3.4.list
3335
- sudo apt-get update -qq
3436
- sudo apt-get install -y -qq postfix
3537
- sh -c 'if [ "$CASHER_DIR" ]; then

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function getEscapedValue($index = null)
136136
$this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT)
137137
);
138138
}
139-
return $value;
139+
return parent::getEscapedValue($index);
140140
}
141141

142142
/**

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function getEscapedValue($index = null)
152152
if ($value instanceof \DateTime) {
153153
return $this->_localeDate->formatDateTime($value);
154154
}
155-
return $value;
155+
return parent::getEscapedValue($index);
156156
}
157157

158158
return parent::getEscapedValue($index);

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/DateTest.php

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Filter;
88

9+
use Magento\Framework\Escaper;
10+
use Magento\Backend\Block\Context;
11+
912
/**
1013
* Class DateTest to test Magento\Backend\Block\Widget\Grid\Column\Filter\Date
1114
*
@@ -30,6 +33,16 @@ class DateTest extends \PHPUnit_Framework_TestCase
3033
/** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */
3134
protected $localeDateMock;
3235

36+
/**
37+
* @var Escaper|\PHPUnit_Framework_MockObject_MockObject
38+
*/
39+
private $escaperMock;
40+
41+
/**
42+
* @var Context
43+
*/
44+
private $context;
45+
3346
protected function setUp()
3447
{
3548
$this->mathRandomMock = $this->getMockBuilder('Magento\Framework\Math\Random')
@@ -58,14 +71,27 @@ protected function setUp()
5871
->setMethods([])
5972
->getMock();
6073

74+
$this->escaperMock = $this->getMockBuilder(Escaper::class)
75+
->disableOriginalConstructor()
76+
->getMock();
77+
6178
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
79+
80+
$this->context = $objectManagerHelper->getObject(
81+
Context::class,
82+
[
83+
'escaper' => $this->escaperMock
84+
]
85+
);
86+
6287
$this->model = $objectManagerHelper->getObject(
6388
'Magento\Backend\Block\Widget\Grid\Column\Filter\Date',
6489
[
6590
'mathRandom' => $this->mathRandomMock,
6691
'localeResolver' => $this->localeResolverMock,
6792
'dateTimeFormatter' => $this->dateTimeFormatterMock,
68-
'localeDate' => $this->localeDateMock
93+
'localeDate' => $this->localeDateMock,
94+
'context' => $this->context
6995
]
7096
);
7197
$this->model->setColumn($this->columnMock);
@@ -94,6 +120,20 @@ public function testGetHtmlSuccessfulTimestamp()
94120
$this->model->setColumn($this->columnMock);
95121
$this->model->setValue($value);
96122

123+
$map = [
124+
$yesterday->getTimestamp() => $yesterday->getTimestamp(),
125+
$tomorrow->getTimestamp() => $tomorrow->getTimestamp()
126+
];
127+
128+
$this->escaperMock->expects($this->atLeastOnce())
129+
->method('escapeHtml')->will($this->returnCallback(
130+
function ($data) use ($yesterday, $tomorrow, $map) {
131+
if (isset($map[(string) $data])) {
132+
return $map[$data];
133+
}
134+
}
135+
));
136+
97137
$output = $this->model->getHtml();
98138
$this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
99139
$this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/DatetimeTest.php

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Filter;
88

9+
use Magento\Framework\Escaper;
10+
use Magento\Backend\Block\Context;
11+
912
/**
1013
* Class DateTimeTest to test Magento\Backend\Block\Widget\Grid\Column\Filter\Date
1114
*
@@ -30,6 +33,16 @@ class DatetimeTest extends \PHPUnit_Framework_TestCase
3033
/** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */
3134
protected $localeDateMock;
3235

36+
/**
37+
* @var Escaper|\PHPUnit_Framework_MockObject_MockObject
38+
*/
39+
private $escaperMock;
40+
41+
/**
42+
* @var Context
43+
*/
44+
private $context;
45+
3346
protected function setUp()
3447
{
3548
$this->mathRandomMock = $this->getMockBuilder('Magento\Framework\Math\Random')
@@ -58,14 +71,27 @@ protected function setUp()
5871
->setMethods([])
5972
->getMock();
6073

74+
$this->escaperMock = $this->getMockBuilder(Escaper::class)
75+
->disableOriginalConstructor()
76+
->getMock();
77+
6178
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
79+
80+
$this->context = $objectManagerHelper->getObject(
81+
Context::class,
82+
[
83+
'escaper' => $this->escaperMock
84+
]
85+
);
86+
6287
$this->model = $objectManagerHelper->getObject(
6388
'Magento\Backend\Block\Widget\Grid\Column\Filter\Datetime',
6489
[
6590
'mathRandom' => $this->mathRandomMock,
6691
'localeResolver' => $this->localeResolverMock,
6792
'dateTimeFormatter' => $this->dateTimeFormatterMock,
68-
'localeDate' => $this->localeDateMock
93+
'localeDate' => $this->localeDateMock,
94+
'context' => $this->context
6995
]
7096
);
7197
$this->model->setColumn($this->columnMock);
@@ -94,6 +120,20 @@ public function testGetHtmlSuccessfulTimestamp()
94120
$this->model->setColumn($this->columnMock);
95121
$this->model->setValue($value);
96122

123+
$map = [
124+
$yesterday->getTimestamp() => $yesterday->getTimestamp(),
125+
$tomorrow->getTimestamp() => $tomorrow->getTimestamp()
126+
];
127+
128+
$this->escaperMock->expects($this->atLeastOnce())
129+
->method('escapeHtml')->will($this->returnCallback(
130+
function ($data) use ($yesterday, $tomorrow, $map) {
131+
if (isset($map[(string) $data])) {
132+
return $map[$data];
133+
}
134+
}
135+
));
136+
97137
$output = $this->model->getHtml();
98138
$this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
99139
$this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if ($isField) {
4545
<strong <?php /* @escapeNotVerified */ echo($isCollapsable) ?
4646
'class="admin__collapsible-title" data-toggle="collapse" data-target="#' . $id . '-content"' :
4747
'class="title"'; ?>>
48-
<span><?php /* @escapeNotVerified */ echo $element->getLegend() ?></span>
48+
<span><?php echo $block->escapeHtml($element->getLegend()) ?></span>
4949
</strong>
5050
<?php /* @escapeNotVerified */ echo $titleActions; ?>
5151
</div>
@@ -58,7 +58,7 @@ if ($isField) {
5858
<fieldset class="<?php /* @escapeNotVerified */ echo $cssClass ?>" id="<?php /* @escapeNotVerified */ echo $id ?>">
5959
<?php if ($element->getLegend() && !$isWrapped): ?>
6060
<legend class="<?php /* @escapeNotVerified */ echo $isField ? 'label admin__field-label' : 'admin__legend legend'?>">
61-
<span><?php /* @escapeNotVerified */ echo $element->getLegend() ?></span>
61+
<span><?php echo $block->escapeHtml($element->getLegend()) ?></span>
6262
</legend><br />
6363
<?php endif; ?>
6464
<?php endif; ?>

app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Create extends \Magento\Backup\Controller\Adminhtml\Index
1919
*/
2020
public function execute()
2121
{
22-
if (!$this->getRequest()->isAjax()) {
22+
if (!$this->getRequest()->isAjax() || !$this->getRequest()->isPost()) {
2323
return $this->_redirect('*/*/index');
2424
}
2525

0 commit comments

Comments
 (0)