protected function setUp()
 {
     $this->product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getPriceInfo', '__wakeup', 'getCanShowPrice'], [], '', false);
     $this->priceInfo = $this->getMock('Magento\\Framework\\Pricing\\PriceInfo', ['getPrice'], [], '', false);
     $this->product->expects($this->any())->method('getPriceInfo')->will($this->returnValue($this->priceInfo));
     $eventManager = $this->getMock('Magento\\Framework\\Event\\Test\\Unit\\ManagerStub', [], [], '', false);
     $config = $this->getMock('Magento\\Store\\Model\\Store\\Config', [], [], '', false);
     $this->layout = $this->getMock('Magento\\Framework\\View\\Layout', [], [], '', false);
     $this->priceBox = $this->getMock('Magento\\Framework\\Pricing\\Render\\PriceBox', [], [], '', false);
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->layout->expects($this->any())->method('getBlock')->will($this->returnValue($this->priceBox));
     $cacheState = $this->getMockBuilder(\Magento\Framework\App\Cache\StateInterface::class)->getMockForAbstractClass();
     $scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false);
     $context->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
     $context->expects($this->any())->method('getStoreConfig')->will($this->returnValue($config));
     $context->expects($this->any())->method('getLayout')->will($this->returnValue($this->layout));
     $context->expects($this->any())->method('getLogger')->will($this->returnValue($this->logger));
     $context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfigMock));
     $context->expects($this->any())->method('getCacheState')->will($this->returnValue($cacheState));
     $this->rendererPool = $this->getMockBuilder('Magento\\Framework\\Pricing\\Render\\RendererPool')->disableOriginalConstructor()->getMock();
     $this->price = $this->getMock('Magento\\Framework\\Pricing\\Price\\PriceInterface');
     $this->price->expects($this->any())->method('getPriceCode')->will($this->returnValue(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE));
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->object = $objectManager->getObject('Magento\\Catalog\\Pricing\\Render\\FinalPriceBox', ['context' => $context, 'saleableItem' => $this->product, 'rendererPool' => $this->rendererPool, 'price' => $this->price, 'data' => ['zone' => 'test_zone']]);
 }
 /**
  * @param array $data
  * @param string $priceCode
  * @param array $cssClasses
  * @dataProvider toHtmlDataProvider
  */
 public function testToHtml($data, $priceCode, $cssClasses)
 {
     $this->price->expects($this->once())->method('getPriceCode')->will($this->returnValue($priceCode));
     $priceBox = $this->objectManager->getObject('Magento\\Framework\\Pricing\\Render\\PriceBox', ['context' => $this->context, 'saleableItem' => $this->saleable, 'price' => $this->price, 'rendererPool' => $this->rendererPool, 'data' => $data]);
     $priceBox->toHtml();
     $this->assertEquals($cssClasses, $priceBox->getData('css_classes'));
 }
 public function testGetAmount()
 {
     $resultPrice = rand(1, 9);
     $this->price->expects($this->once())->method('getValue')->willReturn($resultPrice);
     $this->priceInfo->expects($this->once())->method('getPrice')->with(BasePrice::PRICE_CODE)->willReturn($this->price);
     $this->calculator->expects($this->once())->method('getAmount')->with($resultPrice, $this->saleableItem)->willReturn($resultPrice);
     $this->assertEquals($resultPrice, $this->model->getAmount());
 }
 public function testSetLayout()
 {
     $layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->getMockForAbstractClass();
     $this->price->expects($this->once())->method('setItem')->with($this->item)->willReturnSelf();
     $this->assertInstanceOf('Magento\\Wishlist\\Pricing\\Render\\ConfiguredPriceBox', $this->model->setLayout($layoutMock));
 }