public function testSetTemplateNoProduct() { $this->_helper->expects($this->once())->method('isStockAlertAllowed')->will($this->returnValue(true)); $this->_helper->expects($this->never())->method('getSaveUrl'); $this->_registry->expects($this->any())->method('registry')->with('current_product')->will($this->returnValue(null)); $this->_block->setLayout($this->_layout); $this->_block->setTemplate('path/to/template.phtml'); $this->assertEquals('', $this->_block->getTemplate()); $this->assertNull($this->_block->getSignupUrl()); }
/** * Retrieve stock block * * @return \Magento\ProductAlert\Block\Email\Stock */ protected function _getStockBlock() { if ($this->_stockBlock === null) { $this->_stockBlock = $this->_productAlertData->createBlock('Magento\\ProductAlert\\Block\\Email\\Stock'); } return $this->_stockBlock; }