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


PHP helper::getCommentId方法代碼示例

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


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

示例1: testFileBasedDataStoreWorks

 public function testFileBasedDataStoreWorks()
 {
     $this->_model->delete(helper::getPasteId());
     // storing pastes
     $paste = helper::getPaste(array('expire_date' => 1344803344));
     $this->assertFalse($this->_model->exists(helper::getPasteId()), 'paste does not yet exist');
     $this->assertTrue($this->_model->create(helper::getPasteId(), $paste), 'store new paste');
     $this->assertTrue($this->_model->exists(helper::getPasteId()), 'paste exists after storing it');
     $this->assertFalse($this->_model->create(helper::getPasteId(), $paste), 'unable to store the same paste twice');
     $this->assertEquals(json_decode(json_encode($paste)), $this->_model->read(helper::getPasteId()));
     // storing comments
     $this->assertFalse($this->_model->existsComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId()), 'comment does not yet exist');
     $this->assertTrue($this->_model->createComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId(), helper::getComment()) !== false, 'store comment');
     $this->assertTrue($this->_model->existsComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId()), 'comment exists after storing it');
     $comment = json_decode(json_encode(helper::getComment()));
     $comment->id = helper::getCommentId();
     $comment->parentid = helper::getPasteId();
     $this->assertEquals(array($comment->meta->postdate => $comment), $this->_model->readComments(helper::getPasteId()));
     // deleting pastes
     $this->_model->delete(helper::getPasteId());
     $this->assertFalse($this->_model->exists(helper::getPasteId()), 'paste successfully deleted');
     $this->assertFalse($this->_model->existsComment(helper::getPasteId(), helper::getPasteId(), helper::getCommentId()), 'comment was deleted with paste');
     $this->assertFalse($this->_model->read(helper::getPasteId()), 'paste can no longer be found');
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:24,代碼來源:data.php

示例2: testImplicitDefaults

 public function testImplicitDefaults()
 {
     $pasteData = helper::getPaste();
     $commentData = helper::getComment();
     $this->_model->getPaste(helper::getPasteId())->delete();
     $paste = $this->_model->getPaste();
     $paste->setData($pasteData['data']);
     $paste->setBurnafterreading();
     $paste->setOpendiscussion();
     // not setting a formatter, should use default one
     $paste->store();
     $paste = $this->_model->getPaste(helper::getPasteId())->get();
     // ID was set based on data
     $this->assertEquals(true, property_exists($paste->meta, 'burnafterreading') && $paste->meta->burnafterreading, 'burn after reading takes precendence');
     $this->assertEquals(false, property_exists($paste->meta, 'opendiscussion') && $paste->meta->opendiscussion, 'opendiscussion is disabled');
     $this->assertEquals($this->_conf->getKey('defaultformatter'), $paste->meta->formatter, 'default formatter is set');
     $this->_model->getPaste(helper::getPasteId())->delete();
     $paste = $this->_model->getPaste();
     $paste->setData($pasteData['data']);
     $paste->setBurnafterreading('0');
     $paste->setOpendiscussion();
     $paste->store();
     $vz = new vizhash16x16();
     $pngdata = 'data:image/png;base64,' . base64_encode($vz->generate($_SERVER['REMOTE_ADDR']));
     $comment = $paste->getComment(helper::getPasteId());
     $comment->setData($commentData['data']);
     $comment->setNickname($commentData['meta']['nickname']);
     $comment->store();
     $comment = $paste->getComment(helper::getPasteId(), helper::getCommentId())->get();
     $this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
 }
開發者ID:danesjenovdan,項目名稱:DJNBin,代碼行數:31,代碼來源:model.php

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