public function testCreateTaxRateCollectionItem()
 {
     $this->rateServiceMock->expects($this->once())->method('getList')->with($this->searchCriteriaMock)->willReturn($this->searchResultsMock);
     $this->searchResultsMock->expects($this->once())->method('getTotalCount')->willReturn(123);
     $this->searchResultsMock->expects($this->once())->method('getItems')->willReturn([$this->taxRateMock]);
     $this->taxRateMock->expects($this->once())->method('getId')->willReturn(33);
     $this->taxRateMock->expects($this->once())->method('getCode')->willReturn(44);
     $this->taxRateMock->expects($this->once())->method('getTaxCountryId')->willReturn('CountryId');
     $this->taxRateMock->expects($this->once())->method('getTaxRegionId')->willReturn(55);
     $this->taxRateMock->expects($this->once())->method('getRegionName')->willReturn('Region Name');
     $this->taxRateMock->expects($this->once())->method('getTaxPostcode')->willReturn('Post Code');
     $this->taxRateMock->expects($this->once())->method('getRate')->willReturn(1.85);
     $this->rateConverterMock->expects($this->once())->method('createTitleArrayFromServiceObject')->with($this->taxRateMock)->willReturn([]);
     $this->taxRateMock->expects($this->exactly(2))->method('getZipTo')->willReturn(1);
     $this->taxRateMock->expects($this->exactly(2))->method('getZipFrom')->willReturn(200);
     $this->model->loadData();
 }
Esempio n. 2
0
 /**
  * Get Tax Rates Collection
  *
  * @return mixed
  */
 public function getRateCollection()
 {
     if ($this->getData('rate_collection') == null) {
         $items = $this->_taxRateCollection->getItems();
         $rates = [];
         foreach ($items as $rate) {
             $rateData = $rate->getData();
             if (isset($rateData['titles'])) {
                 foreach ($rateData['titles'] as $storeId => $value) {
                     $rateData['title[' . $storeId . ']'] = $value;
                 }
             }
             unset($rateData['titles']);
             $rates[] = $rateData;
         }
         $this->setRateCollection($rates);
     }
     return $this->getData('rate_collection');
 }