mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-12-17 19:54:23 -05:00
apply StyleCI patch
This commit is contained in:
parent
632d70412a
commit
1e44902340
@ -243,20 +243,20 @@ class Database extends AbstractData
|
|||||||
$isVersion2 = array_key_exists('v', $data) && $data['v'] >= 2;
|
$isVersion2 = array_key_exists('v', $data) && $data['v'] >= 2;
|
||||||
if ($isVersion2) {
|
if ($isVersion2) {
|
||||||
self::$_cache[$pasteid] = $data;
|
self::$_cache[$pasteid] = $data;
|
||||||
list($createdKey) = self::_getVersionedKeys(2);
|
list($createdKey) = self::_getVersionedKeys(2);
|
||||||
} else {
|
} else {
|
||||||
self::$_cache[$pasteid] = array('data' => $paste['data']);
|
self::$_cache[$pasteid] = array('data' => $paste['data']);
|
||||||
list($createdKey) = self::_getVersionedKeys(1);
|
list($createdKey) = self::_getVersionedKeys(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$paste['meta'] = json_decode($paste['meta'], true);
|
$paste['meta'] = json_decode($paste['meta'], true);
|
||||||
if (!is_array($paste['meta'])) {
|
if (!is_array($paste['meta'])) {
|
||||||
$paste['meta'] = array();
|
$paste['meta'] = array();
|
||||||
}
|
}
|
||||||
$paste = self::upgradePreV1Format($paste);
|
$paste = self::upgradePreV1Format($paste);
|
||||||
self::$_cache[$pasteid]['meta'] = $paste['meta'];
|
self::$_cache[$pasteid]['meta'] = $paste['meta'];
|
||||||
self::$_cache[$pasteid]['meta'][$createdKey] = (int) $paste['postdate'];
|
self::$_cache[$pasteid]['meta'][$createdKey] = (int) $paste['postdate'];
|
||||||
$expire_date = (int) $paste['expiredate'];
|
$expire_date = (int) $paste['expiredate'];
|
||||||
if ($expire_date > 0) {
|
if ($expire_date > 0) {
|
||||||
self::$_cache[$pasteid]['meta']['expire_date'] = $expire_date;
|
self::$_cache[$pasteid]['meta']['expire_date'] = $expire_date;
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ class Database extends AbstractData
|
|||||||
$data = json_encode($comment);
|
$data = json_encode($comment);
|
||||||
}
|
}
|
||||||
list($createdKey, $iconKey) = self::_getVersionedKeys($version);
|
list($createdKey, $iconKey) = self::_getVersionedKeys($version);
|
||||||
$meta = $comment['meta'];
|
$meta = $comment['meta'];
|
||||||
unset($comment['meta']);
|
unset($comment['meta']);
|
||||||
foreach (array('nickname', $iconKey) as $key) {
|
foreach (array('nickname', $iconKey) as $key) {
|
||||||
if (!array_key_exists($key, $meta)) {
|
if (!array_key_exists($key, $meta)) {
|
||||||
@ -381,7 +381,7 @@ class Database extends AbstractData
|
|||||||
$comments = array();
|
$comments = array();
|
||||||
if (count($rows)) {
|
if (count($rows)) {
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$i = $this->getOpenSlot($comments, (int) $row['postdate']);
|
$i = $this->getOpenSlot($comments, (int) $row['postdate']);
|
||||||
$data = json_decode($row['data'], true);
|
$data = json_decode($row['data'], true);
|
||||||
if (array_key_exists('v', $data) && $data['v'] >= 2) {
|
if (array_key_exists('v', $data) && $data['v'] >= 2) {
|
||||||
$version = 2;
|
$version = 2;
|
||||||
@ -391,9 +391,9 @@ class Database extends AbstractData
|
|||||||
$comments[$i] = array('data' => $row['data']);
|
$comments[$i] = array('data' => $row['data']);
|
||||||
}
|
}
|
||||||
list($createdKey, $iconKey) = self::_getVersionedKeys($version);
|
list($createdKey, $iconKey) = self::_getVersionedKeys($version);
|
||||||
$comments[$i]['id'] = $row['dataid'];
|
$comments[$i]['id'] = $row['dataid'];
|
||||||
$comments[$i]['parentid'] = $row['parentid'];
|
$comments[$i]['parentid'] = $row['parentid'];
|
||||||
$comments[$i]['meta'] = array($createdKey => (int) $row['postdate']);
|
$comments[$i]['meta'] = array($createdKey => (int) $row['postdate']);
|
||||||
foreach (array('nickname' => 'nickname', 'vizhash' => $iconKey) as $rowKey => $commentKey) {
|
foreach (array('nickname' => 'nickname', 'vizhash' => $iconKey) as $rowKey => $commentKey) {
|
||||||
if (array_key_exists($rowKey, $row) && !empty($row[$rowKey])) {
|
if (array_key_exists($rowKey, $row) && !empty($row[$rowKey])) {
|
||||||
$comments[$i]['meta'][$commentKey] = $row[$rowKey];
|
$comments[$i]['meta'][$commentKey] = $row[$rowKey];
|
||||||
@ -486,7 +486,6 @@ class Database extends AbstractData
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get version dependent key names
|
* get version dependent key names
|
||||||
*
|
*
|
||||||
|
@ -177,6 +177,5 @@ abstract class AbstractModel
|
|||||||
*/
|
*/
|
||||||
protected function _validate(array $data)
|
protected function _validate(array $data)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,10 +195,9 @@ class Paste extends AbstractModel
|
|||||||
if (!array_key_exists('adata', $this->_data) && !array_key_exists('data', $this->_data)) {
|
if (!array_key_exists('adata', $this->_data) && !array_key_exists('data', $this->_data)) {
|
||||||
$this->get();
|
$this->get();
|
||||||
}
|
}
|
||||||
return (
|
return
|
||||||
(array_key_exists('adata', $this->_data) && $this->_data['adata'][3] === 1) ||
|
(array_key_exists('adata', $this->_data) && $this->_data['adata'][3] === 1) ||
|
||||||
(array_key_exists('burnafterreading', $this->_data['meta']) && $this->_data['meta']['burnafterreading'])
|
(array_key_exists('burnafterreading', $this->_data['meta']) && $this->_data['meta']['burnafterreading']);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,10 +212,9 @@ class Paste extends AbstractModel
|
|||||||
if (!array_key_exists('adata', $this->_data) && !array_key_exists('data', $this->_data)) {
|
if (!array_key_exists('adata', $this->_data) && !array_key_exists('data', $this->_data)) {
|
||||||
$this->get();
|
$this->get();
|
||||||
}
|
}
|
||||||
return (
|
return
|
||||||
(array_key_exists('adata', $this->_data) && $this->_data['adata'][2] === 1) ||
|
(array_key_exists('adata', $this->_data) && $this->_data['adata'][2] === 1) ||
|
||||||
(array_key_exists('opendiscussion', $this->_data['meta']) && $this->_data['meta']['opendiscussion'])
|
(array_key_exists('opendiscussion', $this->_data['meta']) && $this->_data['meta']['opendiscussion']);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,10 +161,10 @@ class Request
|
|||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
$data = array(
|
$data = array(
|
||||||
'adata' => json_decode($this->getParam('adata', '[]'), true)
|
'adata' => json_decode($this->getParam('adata', '[]'), true),
|
||||||
);
|
);
|
||||||
$required_keys = array('v', 'ct');
|
$required_keys = array('v', 'ct');
|
||||||
$meta = $this->getParam('meta');
|
$meta = $this->getParam('meta');
|
||||||
if (empty($meta)) {
|
if (empty($meta)) {
|
||||||
$required_keys[] = 'pasteid';
|
$required_keys[] = 'pasteid';
|
||||||
$required_keys[] = 'parentid';
|
$required_keys[] = 'parentid';
|
||||||
|
@ -66,13 +66,13 @@ class Helper
|
|||||||
),
|
),
|
||||||
'plaintext',
|
'plaintext',
|
||||||
1,
|
1,
|
||||||
0
|
0,
|
||||||
),
|
),
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'expire' => '5min',
|
'expire' => '5min',
|
||||||
'created' => 1344803344,
|
'created' => 1344803344,
|
||||||
),
|
),
|
||||||
'v' => 2,
|
'v' => 2,
|
||||||
'ct' => 'ME5JF/YBEijp2uYMzLZozbKtWc5wfy6R59NBb7SmRig=',
|
'ct' => 'ME5JF/YBEijp2uYMzLZozbKtWc5wfy6R59NBb7SmRig=',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -155,10 +155,11 @@ class Helper
|
|||||||
*/
|
*/
|
||||||
public static function getPastePost($version = 2, array $meta = array())
|
public static function getPastePost($version = 2, array $meta = array())
|
||||||
{
|
{
|
||||||
$example = self::getPaste($version, $meta);
|
$example = self::getPaste($version, $meta);
|
||||||
$example['meta'] = array('expire' => $example['meta']['expire']);
|
$example['meta'] = array('expire' => $example['meta']['expire']);
|
||||||
return $example;
|
return $example;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get example paste, as received via POST by the user
|
* get example paste, as received via POST by the user
|
||||||
*
|
*
|
||||||
@ -168,9 +169,9 @@ class Helper
|
|||||||
*/
|
*/
|
||||||
public static function getPastePostJson($version = 2, array $meta = array())
|
public static function getPastePostJson($version = 2, array $meta = array())
|
||||||
{
|
{
|
||||||
$example = self::getPastePost($version, $meta);
|
$example = self::getPastePost($version, $meta);
|
||||||
$example['adata'] = json_encode($example['adata']);
|
$example['adata'] = json_encode($example['adata']);
|
||||||
$example['meta'] = json_encode($example['meta']);
|
$example['meta'] = json_encode($example['meta']);
|
||||||
return $example;
|
return $example;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,9 +196,9 @@ class Helper
|
|||||||
{
|
{
|
||||||
$example = $version === 1 ? self::$commentV1 : self::$pasteV2;
|
$example = $version === 1 ? self::$commentV1 : self::$pasteV2;
|
||||||
if ($version === 2) {
|
if ($version === 2) {
|
||||||
$example['pasteid'] = $example['parentid'] = self::getPasteId();
|
$example['pasteid'] = $example['parentid'] = self::getPasteId();
|
||||||
$example['meta']['created'] = self::$commentV1['meta']['postdate'];
|
$example['meta']['created'] = self::$commentV1['meta']['postdate'];
|
||||||
$example['meta']['icon'] = self::$commentV1['meta']['vizhash'];
|
$example['meta']['icon'] = self::$commentV1['meta']['vizhash'];
|
||||||
unset($example['meta']['expire']);
|
unset($example['meta']['expire']);
|
||||||
}
|
}
|
||||||
$example['meta'] = array_merge($example['meta'], $meta);
|
$example['meta'] = array_merge($example['meta'], $meta);
|
||||||
@ -225,7 +226,7 @@ class Helper
|
|||||||
*/
|
*/
|
||||||
public static function getCommentPostJson()
|
public static function getCommentPostJson()
|
||||||
{
|
{
|
||||||
$example = self::getCommentPost();
|
$example = self::getCommentPost();
|
||||||
$example['adata'] = json_encode($example['adata']);
|
$example['adata'] = json_encode($example['adata']);
|
||||||
return $example;
|
return $example;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$_POST['ct'] = ' ';
|
$_POST['ct'] = ' ';
|
||||||
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
||||||
ob_start();
|
ob_start();
|
||||||
new Controller;
|
new Controller;
|
||||||
@ -524,7 +524,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$paste = Helper::getPaste();
|
$paste = Helper::getPaste();
|
||||||
$paste['adata'][2] = 0;
|
$paste['adata'][2] = 0;
|
||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
ob_start();
|
ob_start();
|
||||||
new Controller;
|
new Controller;
|
||||||
@ -638,7 +638,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReadBurn()
|
public function testReadBurn()
|
||||||
{
|
{
|
||||||
$paste = Helper::getPaste();
|
$paste = Helper::getPaste();
|
||||||
$paste['adata'][3] = 1;
|
$paste['adata'][3] = 1;
|
||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
@ -726,7 +726,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReadBurnAfterReading()
|
public function testReadBurnAfterReading()
|
||||||
{
|
{
|
||||||
$burnPaste = Helper::getPaste();
|
$burnPaste = Helper::getPaste();
|
||||||
$burnPaste['adata'][3] = 1;
|
$burnPaste['adata'][3] = 1;
|
||||||
$this->_model->create(Helper::getPasteId(), $burnPaste);
|
$this->_model->create(Helper::getPasteId(), $burnPaste);
|
||||||
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
|
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
|
||||||
|
@ -9,61 +9,61 @@ class FormatV2Test extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(FormatV2::isValid(Helper::getPastePost()), 'valid format');
|
$this->assertTrue(FormatV2::isValid(Helper::getPastePost()), 'valid format');
|
||||||
$this->assertTrue(FormatV2::isValid(Helper::getCommentPost(), true), 'valid format');
|
$this->assertTrue(FormatV2::isValid(Helper::getCommentPost(), true), 'valid format');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][0] = '$';
|
$paste['adata'][0][0] = '$';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of iv');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of iv');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][1] = '$';
|
$paste['adata'][0][1] = '$';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of salt');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of salt');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['ct'] = '$';
|
$paste['ct'] = '$';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of ct');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid base64 encoding of ct');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['ct'] = 'bm9kYXRhbm9kYXRhbm9kYXRhbm9kYXRhbm9kYXRhCg==';
|
$paste['ct'] = 'bm9kYXRhbm9kYXRhbm9kYXRhbm9kYXRhbm9kYXRhCg==';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'low ct entropy');
|
$this->assertFalse(FormatV2::isValid($paste), 'low ct entropy');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][0] = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=';
|
$paste['adata'][0][0] = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'iv too long');
|
$this->assertFalse(FormatV2::isValid($paste), 'iv too long');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][1] = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=';
|
$paste['adata'][0][1] = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'salt too long');
|
$this->assertFalse(FormatV2::isValid($paste), 'salt too long');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['foo'] = 'bar';
|
$paste['foo'] = 'bar';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid additional key');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid additional key');
|
||||||
unset($paste['meta']);
|
unset($paste['meta']);
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid missing key');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid missing key');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['v'] = 0.9;
|
$paste['v'] = 0.9;
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'unsupported version');
|
$this->assertFalse(FormatV2::isValid($paste), 'unsupported version');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][2] = 1000;
|
$paste['adata'][0][2] = 1000;
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'not enough iterations');
|
$this->assertFalse(FormatV2::isValid($paste), 'not enough iterations');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][3] = 127;
|
$paste['adata'][0][3] = 127;
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid key size');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid key size');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][4] = 63;
|
$paste['adata'][0][4] = 63;
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid tag length');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid tag length');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][5] = '!#@';
|
$paste['adata'][0][5] = '!#@';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid algorithm');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid algorithm');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][6] = '!#@';
|
$paste['adata'][0][6] = '!#@';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid mode');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid mode');
|
||||||
|
|
||||||
$paste = Helper::getPastePost();
|
$paste = Helper::getPastePost();
|
||||||
$paste['adata'][0][7] = '!#@';
|
$paste['adata'][0][7] = '!#@';
|
||||||
$this->assertFalse(FormatV2::isValid($paste), 'invalid compression');
|
$this->assertFalse(FormatV2::isValid($paste), 'invalid compression');
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$options['traffic']['limit'] = 0;
|
$options['traffic']['limit'] = 0;
|
||||||
Helper::createIniFile(CONF, $options);
|
Helper::createIniFile(CONF, $options);
|
||||||
$paste = Helper::getPastePostJson();
|
$paste = Helper::getPastePostJson();
|
||||||
$file = tempnam(sys_get_temp_dir(), 'FOO');
|
$file = tempnam(sys_get_temp_dir(), 'FOO');
|
||||||
file_put_contents($file, http_build_query($paste));
|
file_put_contents($file, http_build_query($paste));
|
||||||
Request::setInputStream($file);
|
Request::setInputStream($file);
|
||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
|
@ -90,9 +90,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$comments = $this->_model->getPaste(Helper::getPasteId())->get()['comments'];
|
$comments = $this->_model->getPaste(Helper::getPasteId())->get()['comments'];
|
||||||
$this->assertTrue(count($comments) === 1, 'comment exists after storing it');
|
$this->assertTrue(count($comments) === 1, 'comment exists after storing it');
|
||||||
$commentData['id'] = Helper::getPasteId();
|
$commentData['id'] = Helper::getPasteId();
|
||||||
$commentData['meta']['created'] = current($comments)['meta']['created'];
|
$commentData['meta']['created'] = current($comments)['meta']['created'];
|
||||||
$commentData['meta']['icon'] = current($comments)['meta']['icon'];
|
$commentData['meta']['icon'] = current($comments)['meta']['icon'];
|
||||||
$this->assertEquals($commentData, current($comments));
|
$this->assertEquals($commentData, current($comments));
|
||||||
|
|
||||||
// deleting pastes
|
// deleting pastes
|
||||||
@ -223,9 +223,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInvalidCommentData()
|
public function testInvalidCommentData()
|
||||||
{
|
{
|
||||||
$pasteData = Helper::getPastePost();
|
$pasteData = Helper::getPastePost();
|
||||||
$pasteData['adata'][2] = 0;
|
$pasteData['adata'][2] = 0;
|
||||||
$paste = $this->_model->getPaste(Helper::getPasteId());
|
$paste = $this->_model->getPaste(Helper::getPasteId());
|
||||||
$paste->setData($pasteData);
|
$paste->setData($pasteData);
|
||||||
$paste->store();
|
$paste->store();
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testInvalidCommentParent()
|
public function testInvalidCommentParent()
|
||||||
{
|
{
|
||||||
$paste = $this->_model->getPaste(Helper::getPasteId());
|
$paste = $this->_model->getPaste(Helper::getPasteId());
|
||||||
$comment = $paste->getComment('');
|
$comment = $paste->getComment('');
|
||||||
$comment->store();
|
$comment->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,8 +379,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||||||
$comment->setData($commentData);
|
$comment->setData($commentData);
|
||||||
$comment->store();
|
$comment->store();
|
||||||
|
|
||||||
$vz = new Vizhash16x16();
|
$vz = new Vizhash16x16();
|
||||||
$pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash()));
|
$pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash()));
|
||||||
$comment = current($this->_model->getPaste(Helper::getPasteId())->get()['comments']);
|
$comment = current($this->_model->getPaste(Helper::getPasteId())->get()['comments']);
|
||||||
$this->assertEquals($pngdata, $comment['meta']['icon'], 'nickname triggers vizhash to be set');
|
$this->assertEquals($pngdata, $comment['meta']['icon'], 'nickname triggers vizhash to be set');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user