Example #1
0
 public function testToMongoInString()
 {
     $type = new DateType();
     $function = $this->getTypeFunction($type->toMongoInString());
     $time = time();
     $this->assertEquals(new \MongoDate($time), $function($time));
     $date = new \DateTime();
     $date->setTimestamp($time);
     $this->assertEquals(new \MongoDate($time), $function($date));
     $string = '2010-02-20';
     $this->assertEquals(new \MongoDate(strtotime($string)), $function($string));
 }