Esempio n. 1
0
 public function testGetByLocation()
 {
     $currencyDefault = CMTest_TH::createDefaultCurrency();
     $currencyEUR = CM_Model_Currency::create('978', 'EUR');
     $this->assertEquals($currencyDefault, CM_Model_Currency::getByLocation(null));
     $countryId = CM_Db_Db::insert('cm_model_location_country', array('abbreviation' => 'DE', 'name' => 'Germany'));
     $country = new CM_Model_Location(CM_Model_Location::LEVEL_COUNTRY, $countryId);
     $this->assertEquals($currencyDefault, CM_Model_Currency::getByLocation($country));
     $currencyEUR->setCountryMapping($country);
     $cache = CM_Cache_Local::getInstance();
     $cacheKey = CM_CacheConst::Currency_CountryId . '_countryId:' . $country->getId();
     $cache->delete($cacheKey);
     $this->assertEquals($currencyEUR, CM_Model_Currency::getByLocation($country));
 }