Example #1
0
 /**
  * Retrieve region collection
  *
  * @return \Magento\Directory\Model\Resource\Region\Collection
  */
 public function getRegionCollection()
 {
     if (!$this->_regionCollection) {
         $this->_regionCollection = $this->_regCollectionFactory->create();
         $this->_regionCollection->addCountryFilter($this->getAddress()->getCountryId())->load();
     }
     return $this->_regionCollection;
 }
 /**
  * @dataProvider toOptionArrayDataProvider
  * @param bool $isMultiselect
  * @param array $countries
  * @param array $regions
  * @param array $expectedResult
  */
 public function testToOptionArray($isMultiselect, $countries, $regions, $expectedResult)
 {
     $this->countryCollection->expects($this->once())->method('toOptionArray')->with(false)->will($this->returnValue(new \ArrayIterator($countries)));
     $this->regionCollection->expects($this->once())->method('getIterator')->will($this->returnValue(new \ArrayIterator($regions)));
     $this->assertEquals($expectedResult, $this->model->toOptionArray($isMultiselect));
 }