コード例 #1
0
 /**
  * resets the init code to the base config file
  */
 public static function clear_init_code()
 {
     self::$init_code = array();
     self::$vars = array();
     self::$silverstripe_db_included = false;
     if (self::$base_init_code) {
         array_unshift(self::$init_code, self::$base_init_code);
     }
 }
コード例 #2
0
 /**
  * check silverstripe db stub
  */
 public function testRequireSilverstripeDB()
 {
     LivePubHelper::$init_code = array();
     // check that nothing happens when not publishing
     LivePubHelper::require_silverstripe_db();
     $this->assertEquals(count(LivePubHelper::$init_code), 0);
     // check that it does happen when publishing
     LivePubHelper::init_pub();
     LivePubHelper::require_silverstripe_db();
     $this->assertEquals(count(LivePubHelper::$init_code), 1);
     $this->assertEquals(preg_match('/\\$databaseConfig = array \\(.+\\);/ms', LivePubHelper::$init_code[0]), 1);
     // check that it's not included twice
     LivePubHelper::require_silverstripe_db();
     $this->assertEquals(count(LivePubHelper::$init_code), 1);
     LivePubHelper::stop_pub();
 }