mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-09-19 04:04:47 -04:00
updated .htaccess format, refactored .htaccess creation logic and improving code coverage, fixes #194
This commit is contained in:
parent
88b02d866e
commit
ce92bfa934
10 changed files with 119 additions and 44 deletions
|
@ -82,6 +82,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||
$comment = $paste->getComment(Helper::getPasteId());
|
||||
$comment->setData($commentData['data']);
|
||||
$comment->setNickname($commentData['meta']['nickname']);
|
||||
$comment->getParentId();
|
||||
$comment->store();
|
||||
|
||||
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
|
||||
|
@ -189,6 +190,27 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertFalse(Paste::isValidId('../bar/baz'), 'path attack');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 64
|
||||
*/
|
||||
public function testInvalidPaste()
|
||||
{
|
||||
$this->_model->getPaste(Helper::getPasteId())->delete();
|
||||
$paste = $this->_model->getPaste(Helper::getPasteId());
|
||||
$paste->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 61
|
||||
*/
|
||||
public function testInvalidData()
|
||||
{
|
||||
$paste = $this->_model->getPaste();
|
||||
$paste->setData('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 62
|
||||
|
@ -199,6 +221,37 @@ class ModelTest extends PHPUnit_Framework_TestCase
|
|||
$paste->getComment(Helper::getPasteId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 67
|
||||
*/
|
||||
public function testInvalidCommentDeletedPaste()
|
||||
{
|
||||
$pasteData = Helper::getPaste();
|
||||
$paste = $this->_model->getPaste(Helper::getPasteId());
|
||||
$paste->setData($pasteData['data']);
|
||||
$paste->store();
|
||||
|
||||
$comment = $paste->getComment(Helper::getPasteId());
|
||||
$paste->delete();
|
||||
$comment->store();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 68
|
||||
*/
|
||||
public function testInvalidCommentData()
|
||||
{
|
||||
$pasteData = Helper::getPaste();
|
||||
$paste = $this->_model->getPaste(Helper::getPasteId());
|
||||
$paste->setData($pasteData['data']);
|
||||
$paste->store();
|
||||
|
||||
$comment = $paste->getComment(Helper::getPasteId());
|
||||
$comment->store();
|
||||
}
|
||||
|
||||
public function testExpiration()
|
||||
{
|
||||
$pasteData = Helper::getPaste();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue