Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfiguredPriceBoxTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class ConfiguredPriceBoxTest extends \PHPUnit\Framework\TestCase
11 {
15  private $templateContext;
16 
20  private $saleableItem;
21 
25  private $price;
26 
30  private $rendererPool;
31 
35  private $model;
36 
40  private $item;
41 
42  protected function setUp()
43  {
44  $this->templateContext = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class)
45  ->disableOriginalConstructor()
46  ->getMock();
47 
48  $this->saleableItem = $this->getMockBuilder(\Magento\Framework\Pricing\SaleableInterface::class)
49  ->getMockForAbstractClass();
50 
51  $this->price = $this->getMockBuilder(\Magento\Framework\Pricing\Price\PriceInterface::class)
52  ->setMethods(['setItem'])
53  ->getMockForAbstractClass();
54 
55  $this->rendererPool = $this->getMockBuilder(\Magento\Framework\Pricing\Render\RendererPool::class)
56  ->disableOriginalConstructor()
57  ->getMock();
58 
59  $this->item = $this->getMockBuilder(\Magento\Catalog\Model\Product\Configuration\Item\ItemInterface::class)
60  ->getMockForAbstractClass();
61 
62  $this->model = new ConfiguredPriceBox(
63  $this->templateContext,
64  $this->saleableItem,
65  $this->price,
66  $this->rendererPool,
67  ['item' => $this->item]
68  );
69  }
70 
71  public function testSetLayout()
72  {
73  $layoutMock = $this->getMockBuilder(\Magento\Framework\View\LayoutInterface::class)
74  ->getMockForAbstractClass();
75 
76  $this->price->expects($this->once())
77  ->method('setItem')
78  ->with($this->item)
79  ->willReturnSelf();
80 
81  $this->assertInstanceOf(
82  \Magento\Wishlist\Pricing\Render\ConfiguredPriceBox::class,
83  $this->model->setLayout($layoutMock)
84  );
85  }
86 }