public function testDatastoreEnum()
 {
     $e = M3_Util_DatastoreEnum::DB();
     $this->assertEquals(M3_Util_DatastoreEnum::_DB, $e->getValue());
     $this->assertTrue($e->isDB());
     $e = M3_Util_DatastoreEnum::create(M3_Util_DatastoreEnum::_DB);
     $this->assertEquals(M3_Util_DatastoreEnum::_DB, $e->getValue());
     $this->assertTrue($e->isDB());
     // create an invalid enum - for now, this will log an error and default to something valid
     $e = M3_Util_DatastoreEnum::create('invalid');
     $this->assertEquals(M3_Util_DatastoreEnum::_DB, $e->getValue());
     $this->assertTrue($e->isDB());
     $values = M3_Util_DatastoreEnum::getEnums();
     $this->assertEquals(1, count($values));
     $this->assertTrue($values[0] === M3_Util_DatastoreEnum::_DB);
 }
Beispiel #2
0
 /**
  * Returns the datastore type that M3 should use which determines how and where
  * its data is persisted.
  *
  * @return M3_Util_DatastoreEnum datastore type
  */
 public static function getDatastore()
 {
     include 'LocalSettings.php';
     if (!isset($m3Datastore) || empty($m3Datastore)) {
         // user didn't specify, our default is the DB
         $_ds = M3_Util_DatastoreEnum::DB();
     } else {
         $_ds = M3_Util_DatastoreEnum::create($m3Datastore);
     }
     return $_ds;
 }