Example #1
0
 public function testGetTotalsRenderer()
 {
     $areaCode = 'frontend';
     $section = 'config';
     $group = 'sales';
     $code = 'payment';
     $path = $section . '/' . $group . '/' . $code . '/' . 'renderers' . '/' . $areaCode;
     $expected = ['test data'];
     $this->stateMock->expects($this->once())->method('getAreaCode')->will($this->returnValue($areaCode));
     $this->configDataMock->expects($this->once())->method('get')->with($this->equalTo($path))->will($this->returnValue($expected));
     $result = $this->model->getTotalsRenderer($section, $group, $code);
     $this->assertEquals($expected, $result);
 }
Example #2
0
 /**
  * @param string $code
  * @return BlockInterface
  */
 protected function _getTotalRenderer($code)
 {
     $blockName = $code . '_total_renderer';
     $block = $this->getLayout()->getBlock($blockName);
     if (!$block) {
         $renderer = $this->_salesConfig->getTotalsRenderer('quote', 'totals', $code);
         if (!empty($renderer)) {
             $block = $renderer;
         } else {
             $block = $this->_defaultRenderer;
         }
         $block = $this->getLayout()->createBlock($block, $blockName);
     }
     /**
      * Transfer totals to renderer
      */
     $block->setTotals($this->getTotals());
     return $block;
 }