hasTimezone() public method

public hasTimezone ( dateTimezone $timezone, $failMessage = null )
$timezone dateTimezone
Beispiel #1
0
 public function testHasTimezone()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->exception(function () use($asserter) {
         $asserter->hasSize(rand(0, PHP_INT_MAX));
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Instance of \\dateTime is undefined')->if($asserter->setWith($dateTime = new \DateTime('now', $timezone = new \DateTimezone('Europe/Paris'))))->then->exception(function () use(&$line, &$requiredTimezone, $asserter) {
         $line = __LINE__;
         $asserter->hasTimezone($requiredTimezone = new \DateTimezone('Europe/London'));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Timezone is %s instead of %s'), $timezone->getName(), $requiredTimezone->getName()))->object($asserter->hasTimezone($dateTime->getTimezone()))->isIdenticalTo($asserter);
 }