mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-03-05 13:30:32 -05:00
replaced the term "paste" with the more generic "document"
kudos @Ribas160
This commit is contained in:
@@ -88,7 +88,7 @@ abstract class AbstractModel
|
|||||||
public function setId($id)
|
public function setId($id)
|
||||||
{
|
{
|
||||||
if (!self::isValidId($id)) {
|
if (!self::isValidId($id)) {
|
||||||
throw new Exception('Invalid paste ID.', 60);
|
throw new Exception('Invalid document ID.', 60);
|
||||||
}
|
}
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
}
|
}
|
||||||
@@ -129,14 +129,6 @@ abstract class AbstractModel
|
|||||||
*/
|
*/
|
||||||
abstract public function store();
|
abstract public function store();
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the current instance.
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
abstract public function delete();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if current instance exists in store.
|
* Test if current instance exists in store.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -71,17 +71,6 @@ class Comment extends AbstractModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the comment.
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function delete()
|
|
||||||
{
|
|
||||||
throw new Exception('To delete a comment, delete its parent paste', 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if comment exists in store.
|
* Test if comment exists in store.
|
||||||
*
|
*
|
||||||
@@ -131,7 +120,7 @@ class Comment extends AbstractModel
|
|||||||
public function setParentId($id)
|
public function setParentId($id)
|
||||||
{
|
{
|
||||||
if (!self::isValidId($id)) {
|
if (!self::isValidId($id)) {
|
||||||
throw new Exception('Invalid paste ID.', 65);
|
throw new Exception('Invalid document ID.', 65);
|
||||||
}
|
}
|
||||||
$this->_data['parentid'] = $id;
|
$this->_data['parentid'] = $id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class Paste extends AbstractModel
|
|||||||
$this->_data
|
$this->_data
|
||||||
) === false
|
) === false
|
||||||
) {
|
) {
|
||||||
throw new Exception('Error saving paste. Sorry.', 76);
|
throw new Exception('Error saving document. Sorry.', 76);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ class ControllerTest extends TestCase
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||||
$this->assertEquals('Invalid paste ID.', $response['message'], 'outputs error message');
|
$this->assertEquals('Invalid document ID.', $response['message'], 'outputs error message');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -825,7 +825,7 @@ class ControllerTest extends TestCase
|
|||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertMatchesRegularExpression(
|
$this->assertMatchesRegularExpression(
|
||||||
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
|
'#<div[^>]*id="errormessage"[^>]*>.*Invalid document ID\.#s',
|
||||||
$content,
|
$content,
|
||||||
'outputs delete error correctly'
|
'outputs delete error correctly'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -366,19 +366,6 @@ class ModelTest extends TestCase
|
|||||||
$this->assertEquals((float) 300, (float) $paste['meta']['time_to_live'], 'remaining time is set correctly', 1.0);
|
$this->assertEquals((float) 300, (float) $paste['meta']['time_to_live'], 'remaining time is set correctly', 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCommentDeletion()
|
|
||||||
{
|
|
||||||
$pasteData = Helper::getPastePost();
|
|
||||||
$this->_model->getPaste(Helper::getPasteId())->delete();
|
|
||||||
|
|
||||||
$paste = $this->_model->getPaste();
|
|
||||||
$paste->setData($pasteData);
|
|
||||||
$paste->store();
|
|
||||||
$this->expectException(Exception::class);
|
|
||||||
$this->expectExceptionCode(64);
|
|
||||||
$paste->getComment(Helper::getPasteId())->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPurge()
|
public function testPurge()
|
||||||
{
|
{
|
||||||
$conf = new Configuration;
|
$conf = new Configuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user