Skip to content

Commit 412777e

Browse files
xmavValeriy Nayda
authored andcommitted
MAGETWO-64882: [Performance] Product special price calculation/rendering on Category page
- Fix Static tests after merge
1 parent dc3a7c7 commit 412777e

File tree

1 file changed

+12
-29
lines changed

1 file changed

+12
-29
lines changed

app/code/Magento/Catalog/Test/Unit/Block/Product/ListProductTest.php

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
namespace Magento\Catalog\Test\Unit\Block\Product;
77

88
use Magento\Catalog\Block\Product\Context;
9+
use Magento\Framework\Event\ManagerInterface;
910
use Magento\Framework\Pricing\Render;
11+
use Magento\Framework\Url\Helper\Data;
1012
use Magento\Framework\View\LayoutInterface;
1113

1214
/**
@@ -50,7 +52,7 @@ class ListProductTest extends \PHPUnit_Framework_TestCase
5052
protected $typeInstanceMock;
5153

5254
/**
53-
* @var \Magento\Framework\Url\Helper\Data | \PHPUnit_Framework_MockObject_MockObject
55+
* @var Data | \PHPUnit_Framework_MockObject_MockObject
5456
*/
5557
protected $urlHelperMock;
5658

@@ -74,11 +76,6 @@ class ListProductTest extends \PHPUnit_Framework_TestCase
7476
*/
7577
protected $toolbarMock;
7678

77-
/**
78-
* @var LayoutInterface|\PHPUnit_Framework_MockObject_MockObject
79-
*/
80-
private $layout;
81-
8279
/**
8380
* @var Context|\PHPUnit_Framework_MockObject_MockObject
8481
*/
@@ -160,28 +157,15 @@ protected function setUp()
160157
false
161158
);
162159

163-
$this->urlHelperMock = $this->getMockBuilder(\Magento\Framework\Url\Helper\Data::class)
164-
->disableOriginalConstructor()->getMock();
160+
$this->urlHelperMock = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock();
161+
$this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
162+
$this->renderer = $this->getMockBuilder(Render::class)->disableOriginalConstructor()->getMock();
163+
$eventManager = $this->getMockForAbstractClass(ManagerInterface::class, [], '', false);
165164

166-
$this->layout = $this->getMockBuilder(LayoutInterface::class)
167-
->disableOriginalConstructor()
168-
->getMock();
169-
$this->context = $this->getMockBuilder(Context::class)
170-
->disableOriginalConstructor()
171-
->getMock();
172-
$this->renderer = $this->getMockBuilder(Render::class)
173-
->disableOriginalConstructor()
174-
->getMock();
175-
176-
$this->context->expects($this->any())
177-
->method('getRegistry')
178-
->willReturn($this->registryMock);
179-
$this->context->expects($this->any())
180-
->method('getCartHelper')
181-
->willReturn($this->cartHelperMock);
182-
$this->context->expects($this->any())
183-
->method('getLayout')
184-
->willReturn($this->layout);
165+
$this->context->expects($this->any())->method('getRegistry')->willReturn($this->registryMock);
166+
$this->context->expects($this->any())->method('getCartHelper')->willReturn($this->cartHelperMock);
167+
$this->context->expects($this->any())->method('getLayout')->willReturn($this->layoutMock);
168+
$this->context->expects($this->any())->method('getEventManager')->willReturn($eventManager);
185169

186170
$this->block = $objectManager->getObject(
187171
\Magento\Catalog\Block\Product\ListProduct::class,
@@ -195,7 +179,6 @@ protected function setUp()
195179
]
196180
);
197181
$this->block->setToolbarBlockName('mock');
198-
$this->block->setLayout($this->layoutMock);
199182
}
200183

201184
protected function tearDown()
@@ -305,7 +288,7 @@ public function testSetIsProductListFlagOnGetProductPrice()
305288
->method('setData')
306289
->with('is_product_list', true)
307290
->willReturnSelf();
308-
$this->layout->expects($this->once())
291+
$this->layoutMock->expects($this->once())
309292
->method('getBlock')
310293
->with('product.price.render.default')
311294
->willReturn($this->renderer);

0 commit comments

Comments
 (0)