当前位置: 首页>>代码示例>>PHP>>正文


PHP helper::getComment方法代码示例

本文整理汇总了PHP中helper::getComment方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::getComment方法的具体用法?PHP helper::getComment怎么用?PHP helper::getComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helper的用法示例。


在下文中一共展示了helper::getComment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSjclValidatorValidatesCorrectly

 public function testSjclValidatorValidatesCorrectly()
 {
     $paste = helper::getPasteWithAttachment();
     $this->assertTrue(sjcl::isValid($paste['data']), 'valid sjcl');
     $this->assertTrue(sjcl::isValid($paste['attachment']), 'valid sjcl');
     $this->assertTrue(sjcl::isValid($paste['attachmentname']), 'valid sjcl');
     $this->assertTrue(sjcl::isValid(helper::getComment()['data']), 'valid sjcl');
     $this->assertTrue(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'valid sjcl');
     $this->assertFalse(sjcl::isValid('{"iv":"$","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid base64 encoding of iv');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"$","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid base64 encoding of salt');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","salt":"Gx1vA2/gQ3U","ct":"$"}'), 'invalid base64 encoding of ct');
     $this->assertFalse(sjcl::isValid('{"iv":"MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'iv to long');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'salt to long');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA","foo":"MTIzNDU2Nzg5MDEyMzQ1Njc4OTA="}'), 'invalid additional key');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":0.9,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'unsupported version');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":100,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'not enough iterations');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":127,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid key size');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":63,"mode":"ccm","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid tag length');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"!#@","adata":"","cipher":"aes","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid mode');
     $this->assertFalse(sjcl::isValid('{"iv":"83Ax/OdUav3SanDW9dcQPg","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"!#@","salt":"Gx1vA2/gQ3U","ct":"j7ImByuE5xCqD2YXm6aSyA"}'), 'invalid cipher');
     // @note adata is not validated, except as part of the total message length
 }
开发者ID:danesjenovdan,项目名称:DJNBin,代码行数:22,代码来源:sjcl.php

示例2: 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

示例3: 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

示例4: 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::getComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。