/** * Return total list * * @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal[] Array of totals */ protected function _getTotalsList() { $totals = $this->_pdfConfig->getTotals(); usort($totals, [$this, '_sortTotalsList']); $totalModels = []; foreach ($totals as $totalInfo) { $class = empty($totalInfo['model']) ? null : $totalInfo['model']; $totalModel = $this->_pdfTotalFactory->create($class); $totalModel->setData($totalInfo); $totalModels[] = $totalModel; } return $totalModels; }
public function testGetTotals() { $configuration = ['total1' => ['title' => 'Title1'], 'total2' => ['title' => 'Title2']]; $this->_dataStorage->expects($this->once())->method('get')->with('totals', [])->will($this->returnValue($configuration)); $this->assertSame($configuration, $this->_model->getTotals()); }