Skip to content

Commit b58b7b2

Browse files
author
Yuri Kovsher
committed
Merge remote-tracking branch 'main-ce/develop' into S60PR
2 parents 58ba3a3 + 4f869e9 commit b58b7b2

File tree

46 files changed

+534
-124
lines changed

Some content is hidden

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

46 files changed

+534
-124
lines changed

Gruntfile.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = function (grunt) {
99

1010
var _ = require('underscore'),
1111
path = require('path'),
12+
themes = require('./dev/tools/grunt/configs/themes'),
1213
configDir = './dev/tools/grunt/configs',
1314
taskDir = './dev/tools/grunt/tasks';
1415

@@ -63,14 +64,18 @@ module.exports = function (grunt) {
6364
},
6465

6566
/**
66-
* Refresh magento frontend & backend.
67+
* Refresh themes.
6768
*/
68-
refresh: [
69-
'exec:all',
70-
'less:blank',
71-
'less:luma',
72-
'less:backend'
73-
],
69+
refresh: function () {
70+
var tasks = [
71+
'clean',
72+
'exec:all'
73+
];
74+
_.each(themes, function(theme, name) {
75+
tasks.push('less:' + name);
76+
});
77+
grunt.task.run(tasks);
78+
},
7479

7580
/**
7681
* Documentation

app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66

77
// @codingStandardsIgnoreFile
88
?>
9-
<div class="fieldset additional-cache-management">
10-
<div class="legend">
9+
<div class="additional-cache-management">
10+
<h2>
1111
<span><?php /* @escapeNotVerified */ echo __('Additional Cache Management') ?></span>
12-
</div>
13-
<div class="field">
12+
</h2>
13+
<p>
1414
<button onclick="setLocation('<?php /* @escapeNotVerified */ echo $block->getCleanImagesUrl() ?>')" type="button">
1515
<?php /* @escapeNotVerified */ echo __('Flush Catalog Images Cache') ?>
1616
</button>
17-
<label class="label"><?php /* @escapeNotVerified */ echo __('Pregenerated product images files') ?></label>
18-
</div>
19-
<div class="field">
17+
<span><?php /* @escapeNotVerified */ echo __('Pregenerated product images files') ?></span>
18+
</p>
19+
<p>
2020
<button onclick="setLocation('<?php /* @escapeNotVerified */ echo $block->getCleanMediaUrl() ?>')" type="button">
2121
<?php /* @escapeNotVerified */ echo __('Flush JavaScript/CSS Cache') ?>
2222
</button>
23-
<label class="label"><?php /* @escapeNotVerified */ echo __('Themes JavaScript and CSS files combined to one file.') ?></label>
24-
</div>
23+
<span><?php /* @escapeNotVerified */ echo __('Themes JavaScript and CSS files combined to one file.') ?></span>
24+
</p>
2525
<?php
2626
if (!$block->isInProductionMode()):
2727
?>
28-
<div class="field">
28+
<p>
2929
<button onclick="setLocation('<?php /* @escapeNotVerified */ echo $block->getCleanStaticFilesUrl() ?>')" type="button">
3030
<?php /* @escapeNotVerified */ echo __('Flush Static Files Cache') ?>
3131
</button>
32-
<label class="label"><?php /* @escapeNotVerified */ echo __('Preprocessed view files and static files') ?></label>
33-
</div>
32+
<span><?php /* @escapeNotVerified */ echo __('Preprocessed view files and static files') ?></span>
33+
</p>
3434
<?php
3535
endif;
3636
?>

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Cctypes.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Cctypes extends \Magento\Framework\View\Element\Html\Select
99
{
1010
/**
1111
* All possible credit card types
12-
*
12+
*
1313
* @var array
1414
*/
1515
protected $ccTypes = [];
@@ -49,13 +49,14 @@ public function _toHtml()
4949
}
5050
}
5151
}
52-
$this->setExtraParams('multiple="multiple" style="height:80px;"');
52+
$this->setClass('cc-type-select');
53+
$this->setExtraParams('multiple="multiple"');
5354
return parent::_toHtml();
5455
}
5556

5657
/**
5758
* All possible credit card types
58-
*
59+
*
5960
* @return array
6061
*/
6162
protected function _getCcTypes()

app/code/Magento/Braintree/Test/Unit/Block/Adminhtml/Form/Field/CctypesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testToHtml()
2727
);
2828

2929
$result = $ccTypes->_toHtml();
30-
$expected = '<select name="" id="" class="" title="" multiple="multiple" style="height:80px;">'
30+
$expected = '<select name="" id="" class="cc-type-select" title="" multiple="multiple">'
3131
. '<option value="" ></option></select>';
3232
$this->assertSame($expected, $result);
3333
}

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
class PurgeCache
1717
{
1818
/**
19-
* @var Uri
19+
* @var UriFactory
2020
*/
21-
protected $uri;
21+
protected $uriFactory;
2222

2323
/**
24-
* @var Socket
24+
* @var SocketFactory
2525
*/
26-
protected $socketAdapter;
26+
protected $socketAdapterFactory;
2727

2828
/**
2929
* @var InvalidateLogger
@@ -45,21 +45,21 @@ class PurgeCache
4545
/**
4646
* Constructor
4747
*
48-
* @param Uri $uri
49-
* @param Socket $socketAdapter
48+
* @param UriFactory $uriFactory
49+
* @param SocketFactory $socketAdapterFactory
5050
* @param InvalidateLogger $logger
5151
* @param Reader $configReader
5252
* @param RequestInterface $request
5353
*/
5454
public function __construct(
55-
Uri $uri,
56-
Socket $socketAdapter,
55+
UriFactory $uriFactory,
56+
SocketFactory $socketAdapterFactory,
5757
InvalidateLogger $logger,
5858
DeploymentConfig $config,
5959
RequestInterface $request
6060
) {
61-
$this->uri = $uri;
62-
$this->socketAdapter = $socketAdapter;
61+
$this->uriFactory = $uriFactory;
62+
$this->socketAdapterFactory = $socketAdapterFactory;
6363
$this->logger = $logger;
6464
$this->config = $config;
6565
$this->request = $request;
@@ -74,24 +74,26 @@ public function __construct(
7474
*/
7575
public function sendPurgeRequest($tagsPattern)
7676
{
77+
$uri = $this->uriFactory->create();
78+
$socketAdapter = $this->socketAdapterFactory->create();
7779
$servers = $this->config->get(ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS)
7880
?: [['host' => $this->request->getHttpHost()]];
7981
$headers = ['X-Magento-Tags-Pattern' => $tagsPattern];
80-
$this->socketAdapter->setOptions(['timeout' => 10]);
82+
$socketAdapter->setOptions(['timeout' => 10]);
8183
foreach ($servers as $server) {
8284
$port = isset($server['port']) ? $server['port'] : self::DEFAULT_PORT;
83-
$this->uri->setScheme('http')
85+
$uri->setScheme('http')
8486
->setHost($server['host'])
8587
->setPort($port);
8688
try {
87-
$this->socketAdapter->connect($server['host'], $port);
88-
$this->socketAdapter->write(
89+
$socketAdapter->connect($server['host'], $port);
90+
$socketAdapter->write(
8991
'PURGE',
90-
$this->uri,
92+
$uri,
9193
'1.1',
9294
$headers
9395
);
94-
$this->socketAdapter->close();
96+
$socketAdapter->close();
9597
} catch (Exception $e) {
9698
$this->logger->critical($e->getMessage(), compact('server', 'tagsPattern'));
9799
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CacheInvalidate\Model;
7+
8+
class SocketFactory
9+
{
10+
11+
/**
12+
* @return \Zend\Http\Client\Adapter\Socket
13+
*/
14+
public function create()
15+
{
16+
return new \Zend\Http\Client\Adapter\Socket();
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CacheInvalidate\Model;
7+
8+
class UriFactory
9+
{
10+
11+
/**
12+
* @return \Zend\Uri\Uri
13+
*/
14+
public function create()
15+
{
16+
return new \Zend\Uri\Uri();
17+
}
18+
}

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\CacheInvalidate\Test\Unit\Model;
77

8-
use \Magento\Framework\Config\ConfigOptionsListConstants;
9-
108
class PurgeCacheTest extends \PHPUnit_Framework_TestCase
119
{
1210
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\CacheInvalidate\Model\PurgeCache */
@@ -32,17 +30,25 @@ class PurgeCacheTest extends \PHPUnit_Framework_TestCase
3230
*/
3331
public function setUp()
3432
{
33+
$this->uriFactoryMock = $this->getMock('Magento\CacheInvalidate\Model\UriFactory', [], [], '', false);
3534
$this->uriMock = $this->getMock('\Zend\Uri\Uri', [], [], '', false);
35+
$this->socketFactoryMock = $this->getMock('Magento\CacheInvalidate\Model\SocketFactory', [], [], '', false);
3636
$this->socketAdapterMock = $this->getMock('\Zend\Http\Client\Adapter\Socket', [], [], '', false);
3737
$this->configMock = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);
3838
$this->loggerMock = $this->getMock('Magento\Framework\Cache\InvalidateLogger', [], [], '', false);
3939
$this->requestMock = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false);
4040
$this->socketAdapterMock->expects($this->once())
4141
->method('setOptions')
4242
->with(['timeout' => 10]);
43+
$this->uriFactoryMock->expects($this->once())
44+
->method('create')
45+
->willReturn($this->uriMock);
46+
$this->socketFactoryMock->expects($this->once())
47+
->method('create')
48+
->willReturn($this->socketAdapterMock);
4349
$this->model = new \Magento\CacheInvalidate\Model\PurgeCache(
44-
$this->uriMock,
45-
$this->socketAdapterMock,
50+
$this->uriFactoryMock,
51+
$this->socketFactoryMock,
4652
$this->loggerMock,
4753
$this->configMock,
4854
$this->requestMock
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CacheInvalidate\Test\Unit\Model;
7+
8+
class SocketFactoryTest extends \PHPUnit_Framework_TestCase
9+
{
10+
11+
public function testCreate()
12+
{
13+
$factory = new \Magento\CacheInvalidate\Model\SocketFactory();
14+
$this->assertInstanceOf('\Zend\Http\Client\Adapter\Socket', $factory->create());
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\CacheInvalidate\Test\Unit\Model;
7+
8+
class UriFactoryTest extends \PHPUnit_Framework_TestCase
9+
{
10+
11+
public function testCreate()
12+
{
13+
$factory = new \Magento\CacheInvalidate\Model\UriFactory();
14+
$this->assertInstanceOf('\Zend\Uri\Uri', $factory->create());
15+
}
16+
}

0 commit comments

Comments
 (0)