enabled() public static method

With no parameter, checks to see if the mongo extension is installed. With a parameter, queries for a specific supported feature.
public static enabled ( string $feature = null ) : boolean
$feature string Test for support for a specific feature, i.e. `"transactions"` or `"arrays"`.
return boolean Returns `true` if the particular feature (or if MongoDB) support is enabled, otherwise `false`.
Example #1
0
 public function skip()
 {
     $this->skipIf(!MongoDb::enabled(), 'MongoDb is not enabled');
     $this->skipIf(!CouchDb::enabled(), 'CouchDb is not enabled');
 }
Example #2
0
 public function testArrayConversion()
 {
     $this->skipIf(!MongoDb::enabled(), "MongoDB not enabled, skipping conversion tests.");
     $time = time();
     $doc = new Document(array('data' => array('_id' => new MongoId(), 'date' => new MongoDate($time))));
     $result = $doc->data();
     $this->assertPattern('/^[a-f0-9]{24}$/', $result['_id']);
     $this->assertEqual($time, $result['date']);
 }
Example #3
0
 public function testEnabled()
 {
     $this->assertTrue(MongoDb::enabled());
 }
Example #4
0
 public function testEnabled()
 {
     $this->assertTrue(MongoDb::enabled());
     $this->assertTrue(MongoDb::enabled('arrays'));
     $this->assertTrue(MongoDb::enabled('booleans'));
     $this->assertTrue(MongoDb::enabled('relationships'));
 }