Exemplo n.º 1
0
 public function testEntryValidity()
 {
     $delivery_address_id = $this->order->getDeliveryOrderAddressId();
     $delivery_address = OrderAddressQuery::create()->findPk($delivery_address_id);
     $delivery_address->setCountryId(CountryQuery::create()->findOneByIsoalpha3("FRA")->getId());
     // France metropolitan
     $customer = $this->order->getCustomer();
     $customer->getDefaultAddress()->setCellphone("0600000000");
     $this->order->setCustomer($customer);
     /**
      * Valid cellphone and Country
      * => True
      */
     $this->assertTrue($this->instance->isValid());
     /**
      * empty cellphone
      * => False
      */
     $customer->getDefaultAddress()->setCellphone(null);
     $this->assertFalse($this->instance->isValid());
     /**
      * Invalid country
      * => False
      */
     $delivery_address->setCountryId(CountryQuery::create()->findOneByIsoalpha3("USA")->getId());
     $customer->getDefaultAddress()->setCellphone("0600000000");
     $this->assertFalse($this->instance->isValid());
 }
Exemplo n.º 2
0
 public function addEntry(ExportEntry $export_entry)
 {
     if (!$export_entry->isValid()) {
         throw new \InvalidArgumentException("An export entry is not valid, the customer " . $export_entry->getCustomer()->getRef() . " may have no cellphone");
     }
     $this->exports[] = $export_entry;
 }