Skip to content

Commit a333a03

Browse files
author
Ivan Gavryshko
committed
Merge remote-tracking branch 'mainline/develop' into PR_Branch
2 parents 5b06088 + acd35f4 commit a333a03

File tree

8 files changed

+87
-10
lines changed

8 files changed

+87
-10
lines changed

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassDisable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public function execute()
2626
}
2727
$this->_validateTypes($types);
2828
foreach ($types as $code) {
29+
$this->_cacheTypeList->cleanType($code);
2930
if ($this->_cacheState->isEnabled($code)) {
3031
$this->_cacheState->setEnabled($code, false);
3132
$updatedTypes++;
3233
}
33-
$this->_cacheTypeList->cleanType($code);
3434
}
3535
if ($updatedTypes > 0) {
3636
$this->_cacheState->persist();

app/code/Magento/Backend/Controller/Adminhtml/Cache/MassRefresh.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public function execute()
2727
$this->_validateTypes($types);
2828
foreach ($types as $type) {
2929
$this->_cacheTypeList->cleanType($type);
30-
$this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => $type]);
3130
$updatedTypes++;
3231
}
3332
if ($updatedTypes > 0) {

app/code/Magento/PageCache/Model/Cache/Type.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,33 @@ class Type extends \Magento\Framework\Cache\Frontend\Decorator\TagScope
1919
*/
2020
const CACHE_TAG = 'FPC';
2121

22+
/**
23+
* @var \Magento\Framework\Event\ManagerInterface
24+
*/
25+
private $eventManager;
26+
2227
/**
2328
* @param \Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool
29+
* @param \Magento\Framework\Event\ManagerInterface $eventManager
2430
*/
25-
public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool)
26-
{
31+
public function __construct(
32+
\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool,
33+
\Magento\Framework\Event\ManagerInterface $eventManager
34+
) {
2735
parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
36+
$this->eventManager = $eventManager;
37+
}
38+
39+
/**
40+
* {@inheritdoc}
41+
*
42+
* @param string $mode
43+
* @param array $tags
44+
* @return bool
45+
*/
46+
public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = [])
47+
{
48+
$this->eventManager->dispatch('adminhtml_cache_refresh_type');
49+
return parent::clean($mode, $tags);
2850
}
2951
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\PageCache\Test\Unit\Model\Cache;
7+
8+
class TypeTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/** @var \Magento\PageCache\Model\Cache\Type */
11+
protected $model;
12+
13+
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\ManagerInterface */
14+
protected $eventManagerMock;
15+
16+
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\Cache\Type\FrontendPool */
17+
protected $cacheFrontendPoolMock;
18+
19+
public function setUp()
20+
{
21+
$this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
22+
->disableOriginalConstructor()
23+
->getMock();
24+
$this->cacheFrontendPoolMock = $this->getMockBuilder('Magento\Framework\App\Cache\Type\FrontendPool')
25+
->disableOriginalConstructor()
26+
->getMock();
27+
$cacheFrontend = $this->getMockBuilder('Magento\Framework\Cache\FrontendInterface')
28+
->disableOriginalConstructor()
29+
->getMock();
30+
$this->cacheFrontendPoolMock->expects($this->once())
31+
->method('get')
32+
->willReturn($cacheFrontend);
33+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
34+
$this->model = $objectManager->getObject(
35+
'Magento\PageCache\Model\Cache\Type',
36+
[
37+
'eventManager' => $this->eventManagerMock,
38+
'cacheFrontendPool' => $this->cacheFrontendPoolMock,
39+
]
40+
);
41+
}
42+
43+
public function testClean()
44+
{
45+
$this->eventManagerMock->expects($this->once())
46+
->method('dispatch')
47+
->with('adminhtml_cache_refresh_type');
48+
49+
$this->model->clean();
50+
}
51+
}

app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ public function collect(
171171
$total->setBaseTotalAmount($this->getCode(), $rate->getPrice());
172172
$shippingDescription = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
173173
$address->setShippingDescription(trim($shippingDescription, ' -'));
174-
$total->setShippingAmount($rate->getPrice());
174+
$total->setBaseShippingAmount($rate->getPrice());
175+
$total->setShippingAmount($amountPrice);
175176
$total->setShippingDescription($address->getShippingDescription());
176177
break;
177178
}

app/code/Magento/Quote/Test/Unit/Model/Quote/Address/Total/ShippingTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ protected function setUp()
7070
'Magento\Quote\Model\Quote\Address\Total',
7171
[
7272
'setShippingAmount',
73+
'setBaseShippingAmount',
7374
'setBaseTotalAmount',
7475
'setTotalAmount',
7576
'setShippingDescription',
@@ -229,9 +230,12 @@ public function testCollect()
229230
$this->priceCurrency->expects($this->once())
230231
->method('convert')
231232
->with(5, $this->store)
232-
->willReturn(5);
233+
->willReturn(10);
233234
$this->total->expects($this->once())
234235
->method('setShippingAmount')
236+
->with(10);
237+
$this->total->expects($this->once())
238+
->method('setBaseShippingAmount')
235239
->with(5);
236240
$this->rate->expects($this->once())
237241
->method('getCarrierTitle')

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,8 @@ public function uninstall()
956956
{
957957
$this->log->log('Starting Magento uninstallation:');
958958

959-
$this->cleanupDb();
960959
$this->cleanCaches();
960+
$this->cleanupDb();
961961

962962
$this->log->log('File system cleanup:');
963963
$messages = $this->cleanupFiles->clearAllFiles();

setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function testUninstall()
390390
]));
391391
$this->logger->expects($this->at(0))->method('log')->with('Starting Magento uninstallation:');
392392
$this->logger
393-
->expects($this->at(1))
393+
->expects($this->at(2))
394394
->method('log')
395395
->with('No database connection defined - skipping database cleanup');
396396
$cacheManager = $this->getMock('Magento\Framework\App\Cache\Manager', [], [], '', false);
@@ -400,7 +400,7 @@ public function testUninstall()
400400
->method('get')
401401
->with('Magento\Framework\App\Cache\Manager')
402402
->willReturn($cacheManager);
403-
$this->logger->expects($this->at(2))->method('log')->with('Cache cleared successfully');
403+
$this->logger->expects($this->at(1))->method('log')->with('Cache cleared successfully');
404404
$this->logger->expects($this->at(3))->method('log')->with('File system cleanup:');
405405
$this->logger
406406
->expects($this->at(4))
@@ -494,7 +494,7 @@ private function prepareForUpdateModulesTests()
494494

495495
/**
496496
* Mocking autoload function
497-
*
497+
*
498498
* @returns array
499499
*/
500500
function spl_autoload_functions()

0 commit comments

Comments
 (0)