Exemple #1
0
 /**
  * @return array
  */
 public function sourceDataProvider()
 {
     $address1 = new Address();
     $address2 = new Address();
     $badSource = null;
     $region1 = new BAPRegion(self::TEST_REGION_COMBINED_CODE);
     $region1->setName(self::TEST_REGION_NAME);
     $address1->setRegion($region1);
     $address2->setRegionText(self::TEST_REGION_NAME);
     return ['take region from address, found in magento DB, use region ID' => [$address1, true, ['region' => null, 'region_id' => self::TEST_MAGENTO_REGION_ID]], 'take region from address, not found in magento DB, use region name' => [$address1, false, ['region' => self::TEST_REGION_NAME, 'region_id' => null]], 'region not set, use region text' => [$address2, null, ['region' => self::TEST_REGION_NAME, 'region_id' => null]], 'bad type given' => [$badSource, null, null, '\\InvalidArgumentException']];
 }
Exemple #2
0
 /**
  * @param $region
  * @param $country
  *
  * @return MagentoAddress
  */
 protected function createMagentoAddress($region, $country)
 {
     $address = new MagentoAddress();
     $address->setRegion($region);
     $address->setCountry($country);
     $address->setCity('City');
     $address->setStreet('street');
     $address->setPostalCode(123456);
     $address->setFirstName('John');
     $address->setLastName('Doe');
     $address->setLabel('label');
     $address->setPrimary(true);
     $address->setOrganization('oro');
     $address->setOriginId(1);
     $address->setOrganization($this->organization);
     $this->em->persist($address);
     return $address;
 }