Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | public function testAsMongoDate() |
||
27 | { |
||
28 | if (!extension_loaded('mongodb')) return; |
||
29 | |||
30 | $ts1 = UniversalTimestamp::fromMongodbUTCDateTime( |
||
31 | new \MongoDB\BSON\UTCDatetime(UniversalTimestamp::now()->asMilliseconds()) |
||
32 | ); |
||
33 | $md1 = $ts1->asMongodbUTCDateTime(); |
||
34 | |||
35 | $this->assertTrue($md1 instanceof \MongoDB\BSON\UTCDatetime); |
||
36 | $this->assertEquals($ts1->asSeconds(), (int)floor(((int)$md1->__toString())/1000)); |
||
37 | $this->assertEquals($ts1->asMilliseconds()%1000, ((int)$md1->__toString())%1000); |
||
38 | } |
||
39 | } |
||
40 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.