Skip to content

Instantly share code, notes, and snippets.

@ajgarlag
Last active August 29, 2015 14:16
Show Gist options
  • Save ajgarlag/8421f924ef1f71792cb8 to your computer and use it in GitHub Desktop.
Save ajgarlag/8421f924ef1f71792cb8 to your computer and use it in GitHub Desktop.
Problem with ValueObjects\DateTime\DateTime
<?php
require 'vendor/autoload.php';
function it($m,$p){echo "\033[".($p?"32m✔":"31m✘")." It $m\033[0m\n"; if(!$p)register_shutdown_function(function(){die(1);});}
$nativeDateTime1 = new \DateTime('2015-02-23 20:30:00', new \DateTimeZone('Europe/Madrid'));
$nativeDateTime2 = new \DateTime('2015-02-23 20:30:00', new \DateTimeZone('Europe/London'));
it('should be different', $nativeDateTime1 != $nativeDateTime2);
$voDateTime1 = \ValueObjects\DateTime\DateTime::fromNativeDateTime($nativeDateTime1);
$voDateTime2 = \ValueObjects\DateTime\DateTime::fromNativeDateTime($nativeDateTime2);
it('should be different too', !$voDateTime1->sameValueAs($voDateTime2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment