ValueObjects\DateTime\TimeZone::sameValueAs PHP Method

sameValueAs() public method

Tells whether two DateTimeZone are equal by comparing their names
public sameValueAs ( ValueObjects\ValueObjectInterface $timezone ) : boolean
$timezone ValueObjects\ValueObjectInterface
return boolean
    public function sameValueAs(ValueObjectInterface $timezone)
    {
        if (false === Util::classEquals($this, $timezone)) {
            return false;
        }
        return $this->getName()->sameValueAs($timezone->getName());
    }

Usage Example

Beispiel #1
0
 public function testSameValueAs()
 {
     $timeZone1 = new TimeZone(new StringLiteral('Europe/Madrid'));
     $timeZone2 = new TimeZone(new StringLiteral('Europe/Madrid'));
     $timeZone3 = new TimeZone(new StringLiteral('Europe/Berlin'));
     $this->assertTrue($timeZone1->sameValueAs($timeZone2));
     $this->assertFalse($timeZone1->sameValueAs($timeZone3));
     $mock = $this->getMock('ValueObjects\\ValueObjectInterface');
     $this->assertFalse($timeZone1->sameValueAs($mock));
 }
All Usage Examples Of ValueObjects\DateTime\TimeZone::sameValueAs