Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 public function testGetName()
 {
     $name = new StringLiteral('Europe/Madrid');
     $timeZone = new TimeZone($name);
     $this->assertTrue($name->sameValueAs($timeZone->getName()));
 }
Ejemplo n.º 3
0
 public function testToString()
 {
     $foo = new StringLiteral('foo');
     $this->assertEquals('foo', $foo->__toString());
 }