當前位置: 首頁>>代碼示例>>PHP>>正文


PHP helper::confBackup方法代碼示例

本文整理匯總了PHP中helper::confBackup方法的典型用法代碼示例。如果您正苦於以下問題:PHP helper::confBackup方法的具體用法?PHP helper::confBackup怎麽用?PHP helper::confBackup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在helper的用法示例。


在下文中一共展示了helper::confBackup方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPut

 /**
  * @runInSeparateProcess
  */
 public function testPut()
 {
     $this->reset();
     $options = parse_ini_file(CONF, true);
     $options['traffic']['limit'] = 0;
     helper::confBackup();
     helper::createIniFile(CONF, $options);
     $paste = helper::getPaste();
     unset($paste['meta']);
     $file = tempnam(sys_get_temp_dir(), 'FOO');
     file_put_contents($file, http_build_query($paste));
     request::setInputStream($file);
     $_SERVER['QUERY_STRING'] = helper::getPasteId();
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $_SERVER['REMOTE_ADDR'] = '::1';
     ob_start();
     new zerobin();
     $content = ob_get_contents();
     $response = json_decode($content, true);
     $this->assertEquals(0, $response['status'], 'outputs status');
     $this->assertEquals(helper::getPasteId(), $response['id'], 'outputted paste ID matches input');
     $this->assertEquals(hash_hmac('sha1', $response['id'], serversalt::get()), $response['deletetoken'], 'outputs valid delete token');
     $this->assertStringEndsWith('?' . $response['id'], $response['url'], 'returned URL points to new paste');
     $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:29,代碼來源:jsonApi.php

示例2: reset

 public function reset()
 {
     parent::reset();
     // but then inject a db config
     $options = parse_ini_file(CONF, true);
     $options['model'] = array('class' => 'zerobin_db');
     $options['model_options'] = $this->_options;
     helper::confBackup();
     helper::createIniFile(CONF, $options);
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:10,代碼來源:zerobinWithDb.php

示例3: setUp

 public function setUp()
 {
     /* Setup Routine */
     $options = parse_ini_file(CONF, true);
     $options['model'] = array('class' => 'zerobin_db');
     $options['model_options'] = array('dsn' => 'sqlite::memory:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
     helper::confBackup();
     helper::createIniFile(CONF, $options);
     $this->_conf = new configuration();
     $this->_model = new model($this->_conf);
     $_SERVER['REMOTE_ADDR'] = '::1';
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:12,代碼來源:model.php

示例4: setUp

 public function setUp()
 {
     /* Setup Routine */
     helper::confBackup();
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:5,代碼來源:configuration.php

示例5: testCreateDuplicateComment

 /**
  * @runInSeparateProcess
  */
 public function testCreateDuplicateComment()
 {
     $this->reset();
     $options = parse_ini_file(CONF, true);
     $options['traffic']['limit'] = 0;
     helper::confBackup();
     helper::createIniFile(CONF, $options);
     $this->_model->create(helper::getPasteId(), helper::getPaste());
     $this->_model->createComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId(), helper::getComment());
     $this->assertTrue($this->_model->existsComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId()), 'comment exists before posting data');
     $_POST = helper::getCommentPost();
     $_POST['pasteid'] = helper::getPasteId();
     $_POST['parentid'] = helper::getPasteId();
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['REMOTE_ADDR'] = '::1';
     ob_start();
     new zerobin();
     $content = ob_get_contents();
     $response = json_decode($content, true);
     $this->assertEquals(1, $response['status'], 'outputs error status');
     $this->assertTrue($this->_model->existsComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId()), 'paste exists after posting data');
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:26,代碼來源:zerobin.php


注:本文中的helper::confBackup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。