public function testConvertToBson(\MongoDate $date)
{
$this->skipTestUnless($date instanceof TypeInterface);
$dateTime = $date->toDateTime();
$bsonDate = $date->toBSONType();
$this->assertInstanceOf('MongoDB\\BSON\\UTCDateTime', $bsonDate);
$this->assertSame('1234567890123', (string) $bsonDate);
$bsonDateTime = $bsonDate->toDateTime();
// Compare timestamps to avoid issues with DateTime
$timestamp = $dateTime->format('U') . '.' . $dateTime->format('U');
$bsonTimestamp = $bsonDateTime->format('U') . '.' . $bsonDateTime->format('U');
$this->assertSame((double) $timestamp, (double) $bsonTimestamp);
}