コード例 #1
0
ファイル: ExportTest.php プロジェクト: lopes-vincent/Predict
 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());
 }