/** * Disable block output if banner turned off or PublisherId is miss * * @return string */ protected function _toHtml() { $publisherId = $this->_paypalConfig->getBmlPublisherId(); $display = $this->_paypalConfig->getBmlDisplay($this->_section); $position = $this->_paypalConfig->getBmlPosition($this->_section); if (!$publisherId || $display == 0 || $this->_position != $position) { return ''; } $this->setData('publisher_id', $publisherId); $this->setData('size', $this->_paypalConfig->getBmlSize($this->_section)); return parent::_toHtml(); }
/** * Disable block output if banner turned off or PublisherId is miss * * @return string */ protected function _toHtml() { if (!$this->_paypalConfig->isMethodAvailable(Config::METHOD_WPP_BML) && !$this->_paypalConfig->isMethodAvailable(Config::METHOD_WPP_PE_BML)) { return ''; } $publisherId = $this->_paypalConfig->getBmlPublisherId(); $display = $this->_paypalConfig->getBmlDisplay($this->_section); $position = $this->_paypalConfig->getBmlPosition($this->_section); if (!$publisherId || $display == 0 || $this->_position != $position) { return ''; } $this->setData('publisher_id', $publisherId); $this->setData('size', $this->_paypalConfig->getBmlSize($this->_section)); return parent::_toHtml(); }
/** * @dataProvider dataProviderGetBmlDisplay */ public function testGetBmlDisplay($section, $expectedValue, $expectedFlag, $expected) { $this->_model->setStoreId(1); $this->directoryHelper->expects($this->any())->method('getDefaultCountry')->with(1)->will($this->returnValue('US')); $this->_scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue($expectedFlag)); $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValueMap([['payment/' . Config::METHOD_WPP_BML . '/' . $section . '_display', 'store', 1, $expectedValue], ['payment/' . Config::METHOD_WPP_BML . '/active', 'store', 1, $expectedValue], ['payment/' . Config::METHOD_WPP_PE_BML . '/active', 'store', 1, $expectedValue]])); $this->assertEquals($expected, $this->_model->getBmlDisplay($section)); }