示例#1
0
 /**
  * Returns a new TimeZone object.
  *
  * @param StringLiteral $name
  *
  * @throws InvalidTimeZoneException
  */
 public function __construct(StringLiteral $name)
 {
     if (!in_array($name->toNative(), timezone_identifiers_list())) {
         throw new InvalidTimeZoneException($name);
     }
     $this->name = $name;
 }
示例#2
0
 public function testGetName()
 {
     $name = new StringLiteral('Europe/Madrid');
     $timeZone = new TimeZone($name);
     $this->assertTrue($name->sameValueAs($timeZone->getName()));
 }
 public function testToString()
 {
     $foo = new StringLiteral('foo');
     $this->assertEquals('foo', $foo->__toString());
 }