public function testGetName()
 {
     $code = CountryCode::IT();
     $name = CountryCodeName::getName($code);
     $expectedString = new StringLiteral('Italy');
     $this->assertTrue($name->sameValueAs($expectedString));
 }
示例#2
0
 /**
  * Returns a new Country object given a native PHP string country code
  *
  * @param  string $code
  * @return self
  */
 public static function fromNative()
 {
     $codeString = \func_get_arg(0);
     $code = CountryCode::getByName($codeString);
     $country = new self($code);
     return $country;
 }
 /**
  * Returns country name
  *
  * @param  CountryCode $code
  * @return StringLiteral
  */
 public static function getName(CountryCode $code)
 {
     $codeValue = $code->toNative();
     $name = self::$names[$codeValue];
     return new StringLiteral($name);
 }
示例#4
0
 public function testGetCountry()
 {
     $country = new Country(CountryCode::IT());
     $this->assertTrue($this->address->getCountry()->sameValueAs($country));
 }
示例#5
0
 public function testToString()
 {
     $italy = new Country(CountryCode::IT());
     $this->assertSame('Italy', $italy->__toString());
 }