@@ -31,7 +31,11 @@ protected function setUp()
31
31
{
32
32
parent ::setUp ();
E30A
33
33
34
- if (!extension_loaded ('mongo ' ) && !extension_loaded ('mongodb ' )) {
34
+ if (extension_loaded ('mongodb ' )) {
35
+ if (!class_exists ('MongoDB\Client ' )) {
36
+ $ this ->markTestSkipped ('The mongodb/mongodb package is required. ' );
37
+ }
38
+ } elseif (!extension_loaded ('mongo ' )) {
35
39
$ this ->markTestSkipped ('The Mongo or MongoDB extension is required. ' );
36
40
}
37
41
@@ -109,7 +113,7 @@ public function testRead()
109
113
110
114
if (phpversion ('mongodb ' )) {
111
115
$ that ->assertInstanceOf ('MongoDB\BSON\UTCDateTime ' , $ criteria [$ that ->options ['expiry_field ' ]]['$gte ' ]);
112
- $ that ->assertGreaterThanOrEqual (round ((( int ) $ criteria [$ that ->options ['expiry_field ' ]]['$gte ' ]) / 1000 ), $ testTimeout );
116
+ $ that ->assertGreaterThanOrEqual (round ((string ) $ criteria [$ that ->options ['expiry_field ' ]]['$gte ' ] / 1000 ), $ testTimeout );
113
117
} else {
114
118
$ that ->assertInstanceOf ('MongoDate ' , $ criteria [$ that ->options ['expiry_field ' ]]['$gte ' ]);
115
119
$ that ->assertGreaterThanOrEqual ($ criteria [$ that ->options ['expiry_field ' ]]['$gte ' ]->sec , $ testTimeout );
@@ -168,7 +172,7 @@ public function testWrite()
168
172
$ that ->assertEquals ('bar ' , $ data [$ that ->options ['data_field ' ]]->getData ());
169
173
$ that ->assertInstanceOf ('MongoDB\BSON\UTCDateTime ' , $ data [$ that ->options ['time_field ' ]]);
170
174
$ that ->assertInstanceOf ('MongoDB\BSON\UTCDateTime ' , $ data [$ that ->options ['expiry_field ' ]]);
171
- $ that ->assertGreaterThanOrEqual ($ expectedExpiry , round ((( int ) $ data [$ that ->options ['expiry_field ' ]]) / 1000 ));
175
+ $ that ->assertGreaterThanOrEqual ($ expectedExpiry , round ((string ) $ data [$ that ->options ['expiry_field ' ]] / 1000 ));
172
176
} else {
173
177
$ that ->assertEquals ('bar ' , $ data [$ that ->options ['data_field ' ]]->bin );
174
178
$ that ->assertInstanceOf ('MongoDate ' , $ data [$ that ->options ['time_field ' ]]);
@@ -294,7 +298,7 @@ public function testGc()
294
298
->will ($ this ->returnCallback (function ($ criteria ) use ($ that ) {
295
299
if (phpversion ('mongodb ' )) {
296
300
$ that ->assertInstanceOf ('MongoDB\BSON\UTCDateTime ' , $ criteria [$ that ->options ['expiry_field ' ]]['$lt ' ]);
297
- $ that ->assertGreaterThanOrEqual (time () - 1 , round ((( int ) $ criteria [$ that ->options ['expiry_field ' ]]['$lt ' ]) / 1000 ));
301
+ $ that ->assertGreaterThanOrEqual (time () - 1 , round ((string ) $ criteria [$ that ->options ['expiry_field ' ]]['$lt ' ] / 1000 ));
298
302
} else {
299
303
$ that ->assertInstanceOf ('MongoDate ' , $ criteria [$ that ->options ['expiry_field ' ]]['$lt ' ]);
300
304
$ that ->assertGreaterThanOrEqual (time () - 1 , $ criteria [$ that ->options ['expiry_field ' ]]['$lt ' ]->sec );
0 commit comments