public function testGetItemRowTotalAfterDiscountHtml() { $html = '$34.28'; $this->layoutMock->expects($this->once())->method('getBlock')->with('item_row_total_after_discount')->will($this->returnValue($this->priceRenderBlock)); $this->priceRenderBlock->expects($this->once())->method('setItem')->with($this->itemMock); $this->priceRenderBlock->expects($this->once())->method('toHtml')->will($this->returnValue($html)); $this->assertEquals($html, $this->block->getItemRowTotalAfterDiscountHtml($this->itemMock)); }
public function testGetItemPrice() { $html = '$34.28'; $this->layoutMock->expects($this->once())->method('getBlock')->with('item_price')->will($this->returnValue($this->priceRenderBlock)); $this->priceRenderBlock->expects($this->once())->method('setItem')->with($this->itemMock); $this->priceRenderBlock->expects($this->once())->method('toHtml')->will($this->returnValue($html)); $this->assertEquals($html, $this->block->getItemPrice($this->itemMock)); }
public function testExecuteNoPopup() { $attributesData = ['frontend_label' => '']; $this->request->expects($this->any())->method('getParam')->willReturnMap([['attribute_id', null, null], ['attribute', null, $attributesData], ['popup', null, false]]); $this->objectManagerMock->expects($this->any())->method('create')->with('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute')->willReturn($this->eavAttribute); $this->objectManagerMock->expects($this->any())->method('get')->with('Magento\\Backend\\Model\\Session')->willReturn($this->session); $this->eavAttribute->expects($this->once())->method('setEntityTypeId')->willReturnSelf(); $this->eavAttribute->expects($this->once())->method('addData')->with($attributesData)->willReturnSelf(); $this->registry->expects($this->any())->method('register')->with('entity_attribute', $this->eavAttribute); $this->resultPage->expects($this->any())->method('addBreadcrumb')->willReturnSelf(); $this->resultPage->expects($this->once())->method('setActiveMenu')->with('Magento_Catalog::catalog_attributes_attributes')->willReturnSelf(); $this->resultPage->expects($this->any())->method('getConfig')->willReturn($this->pageConfig); $this->resultPage->expects($this->once())->method('getLayout')->willReturn($this->layout); $this->resultPageFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->resultPage); $this->pageConfig->expects($this->any())->method('getTitle')->willReturn($this->pageTitle); $this->pageTitle->expects($this->any())->method('prepend')->willReturnSelf(); $this->eavAttribute->expects($this->any())->method('getName')->willReturn(null); $this->layout->expects($this->once())->method('getBlock')->willReturn($this->blockTemplate); $this->blockTemplate->expects($this->any())->method('setIsPopup')->willReturnSelf(); $this->assertSame($this->resultPage, $this->editController->execute()); }