Exemplo n.º 1
0
 /**
  * Creates a country object from the provided definition.
  *
  * @param array  $definition The country definition.
  * @param string $locale     The locale of the country definition.
  *
  * @return Country
  */
 protected function createCountryFromDefinition(array $definition, $locale)
 {
     $country = new Country();
     $country->setCountryCode($definition['code']);
     $country->setName($definition['name']);
     $country->setLocale($locale);
     if (isset($definition['three_letter_code'])) {
         $country->setThreeLetterCode($definition['three_letter_code']);
     }
     if (isset($definition['numeric_code'])) {
         $country->setNumericCode($definition['numeric_code']);
     }
     if (isset($definition['telephone_code'])) {
         $country->setTelephoneCode($definition['telephone_code']);
     }
     return $country;
 }
Exemplo n.º 2
0
 /**
  * @covers ::getCountryCode
  * @covers ::setCountryCode
  * @covers ::__toString
  */
 public function testCountryCode()
 {
     $this->country->setCountryCode('US');
     $this->assertEquals('US', $this->country->getCountryCode());
     $this->assertEquals('US', (string) $this->country);
 }