File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 2323 */
2424class DateTest extends \PHPUnit_Framework_TestCase
2525{
26- const SECONDS_PER_DAY = 24 * 60 * 60 ;
26+ const SECONDS_PER_DAY = 86400 ;
2727
2828 public function testConstruct ()
2929 {
@@ -54,12 +54,14 @@ public function testFromDateTime()
5454 // Epoch + 1
5555 $ datetime = new \DateTime ("1970-01-02T00:00:00+0000 " );
5656 $ date = Date::fromDateTime ($ datetime );
57- $ this ->assertEquals ($ date ->seconds (), 24 * 60 * 60 );
57+ $ this ->assertEquals ($ date ->seconds (), self :: SECONDS_PER_DAY );
5858 $ this ->assertEquals ($ date ->toDateTime (), $ datetime );
5959
6060 // Epoch - 1 (should work if cpp-driver >= 2.4.2, otherwise it's broken)
61- //$date = Date::fromDateTime(new \DateTime("1969-12-31T00:00:00"));
62- //$this->assertEquals($date->seconds(), -24 * 60 * 60);
61+ if (version_compare (\Cassandra::CPP_DRIVER_VERSION , "2.4.2 " ) >= 0 ) {
62+ $ date = Date::fromDateTime (new \DateTime ("1969-12-31T00:00:00 " ));
63+ $ this ->assertEquals ($ date ->seconds (), -1 * self ::SECONDS_PER_DAY );
64+ }
6365 }
6466
6567 public function testToDateTimeWithTime ()
You can’t perform that action at this time.
0 commit comments