protected function setupTaxRateFactoryMock(array $taxRate)
 {
     $taxRateMock = $this->getMockBuilder('\\Magento\\Tax\\Api\\Data\\GrandTotalRatesInterface')->getMock();
     $this->ratesFactoryMock->expects($this->once())->method('create')->with([])->willReturn($taxRateMock);
     $taxRateMock->expects($this->once())->method('setPercent')->with($taxRate['percent'])->willReturnSelf();
     $taxRateMock->expects($this->once())->method('setTitle')->with($taxRate['title'])->willReturnSelf();
     return $taxRateMock;
 }
Esempio n. 2
0
 /**
  * @param array $rates
  * @return array
  */
 protected function getRatesData($rates)
 {
     $taxRates = [];
     foreach ($rates as $rate) {
         $taxRate = $this->ratesFactory->create([]);
         $taxRate->setPercent($rate['percent']);
         $taxRate->setTitle($rate['title']);
         $taxRates[] = $taxRate;
     }
     return $taxRates;
 }