public function testTranslateCountry() { $france = CountryQuery::create()->findOneByIsoalpha3("FRA"); $unitedStates = CountryQuery::create()->findOneByIsoalpha3("USA"); $this->assertEquals(CountryEnum::FRANCE_METROPOLITAN, PredictExport::translateCountry($france)); $this->assertNull(PredictExport::translateCountry($unitedStates)); }
/** * @return boolean * Check if the export entry is valid */ public function isValid() { /** * Get country */ $country = $this->getDeliveryOrderCountry(); /** * Do the checks */ $checks = $this->order->getCustomer()->getDefaultAddress()->getCellphone() !== null; $checks &= PredictExport::translateCountry($country) !== null; return (bool) $checks; }