コード例 #1
0
ファイル: SettingsTestCase.php プロジェクト: jkinner/ringside
 public function testSettings()
 {
     $_allowEval = M3_Util_Settings::getAllowOperationEvaluatePhpCode();
     $this->assertType('boolean', $_allowEval);
     $_maxSizeAllowedFileContent = M3_Util_Settings::getMaxSizeAllowedOperationGetFileContent();
     $this->assertGreaterThanOrEqual(0, $_maxSizeAllowedFileContent);
     $_dataDir = M3_Util_Settings::getDataDirectory();
     $this->assertFalse(empty($_dataDir));
     $_dataStoreEnum = M3_Util_Settings::getDatastore();
     $this->assertFalse(empty($_dataStoreEnum));
     $this->assertType(M3_Util_DatastoreEnum, $_dataStoreEnum);
     $_dirs = M3_Util_Settings::getDeployedApiLocations();
     $this->assertEquals(3, count($_dirs));
     $this->assertContains('/ringside/rest', $_dirs);
     $this->assertContains('/m3/rest', $_dirs);
     $this->assertContains('/ringside/api/facebook', $_dirs);
     $_php = M3_Util_Settings::getPhpIniFileLocation();
     $this->assertGreaterThan(strlen("php.ini"), strlen($_php), "should be a full path to the php.ini file");
     $_phpContent = M3_Util_Settings::getPhpIniSettings();
     $this->assertTrue(!empty($_phpContent));
     $_dbProfileEnable = M3_Util_Settings::getDbProfilerEnable();
     $this->assertNotNull($_dbProfileEnable);
     $this->assertTrue($_dbProfileEnable === true || $_dbProfileEnable === false, "Should have been a boolean");
 }
コード例 #2
0
// Set up validation FIXME: this really breaks out stuff, not good
//$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
// Set up caching
if (isset($useDbCache) && $useDbCache === true) {
    $sqlite_conn = Doctrine_Manager::connection(new PDO('sqlite:memory'));
    $cacheDriver = new Doctrine_Cache_Db(array('connection' => $sqlite_conn, 'tableName' => 'ringside_api'));
    try {
        $cacheDriver->createTable();
    } catch (Doctrine_Connection_Exception $e) {
        if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
            $cacheDriver = null;
        }
    }
    if (null !== $cacheDriver) {
        $manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
        $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);
        // Result cache set for 5 minutes - FIXME: this causes php to crash.  Riddle me that!
        //$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 300);
        //Doctrine::ATTR_RESULT_CACHE_LIFESPAN;
        //Doctrine::ATTR_QUERY_CACHE_LIFESPAN
    }
}
$conn = Doctrine_Manager::connection($dsn);
require_once 'ringside/m3/util/Settings.php';
if (M3_Util_Settings::getDbProfilerEnable()) {
    require_once 'ringside/m3/metric/DoctrineProfiler.php';
    $profiler = new M3_Metric_DoctrineProfiler();
    $conn->setListener($profiler);
}
$conn->setAttribute('portability', Doctrine::PORTABILITY_ALL);
spl_autoload_register(array('RingsideApiServer', 'autoload'));