Ejemplo n.º 1
0
 public function testCreateNewDeliveryZoneZipMask()
 {
     $zipMask = DeliveryZoneZipMask::getNewInstance($this->zone, 'Viln%');
     $zipMask->save();
     $zipMask->reload();
     $this->assertEquals($zipMask->deliveryZone->get(), $this->zone);
     $this->assertEquals($zipMask->mask->get(), 'Viln%');
 }
Ejemplo n.º 2
0
 /**
  * @role update
  */
 public function deleteZipMask()
 {
     DeliveryZoneZipMask::getInstanceByID((int) $this->getId())->delete();
     return new JSONResponse(false, 'success');
 }
Ejemplo n.º 3
0
 public function testFindZoneWithMasks()
 {
     $zone1 = DeliveryZone::getNewInstance();
     $zone1->name->set('With ZIP');
     $zone1->isEnabled->set(true);
     $zone1->save();
     DeliveryZoneZipMask::getNewInstance($zone1, 'asd')->save();
     DeliveryZoneCountry::getNewInstance($zone1, 'LT')->save();
     $zone2 = DeliveryZone::getNewInstance();
     $zone2->name->set('Without ZIP');
     $zone2->isEnabled->set(true);
     $zone2->save();
     DeliveryZoneCountry::getNewInstance($zone2, 'LT')->save();
     $address = UserAddress::getNewInstance();
     $address->countryID->set('LT');
     $this->assertSame(DeliveryZone::getZoneByAddress($address), $zone2);
     $address->postalCode->set('asd');
     $this->assertSame(DeliveryZone::getZoneByAddress($address), $zone1);
 }
Ejemplo n.º 4
0
 /**
  * @return ARSet
  */
 public function getZipMasks($loadReferencedRecords = false)
 {
     return DeliveryZoneZipMask::getRecordSetByZone($this, $loadReferencedRecords);
 }