Skip to content

Instantly share code, notes, and snippets.

@MacDada
Last active August 31, 2016 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MacDada/a283554ec81ce3e4a68125a7c073edcf to your computer and use it in GitHub Desktop.
Save MacDada/a283554ec81ce3e4a68125a7c073edcf to your computer and use it in GitHub Desktop.
<?php
public function testInterval()
{
$date = new DateTime('+1 month');
$date->add(\DateInterval::createFromDateString('3 months'));
// Tested on 2016-08-31
// Failed asserting that two DateTime objects are equal.
// Expected :2016-12-31T14:28:49+0000
// Actual :2017-01-01T14:28:49+0000
static::assertEquals(new DateTime('+4 months'), $date);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment