updated .htaccess format, refactored .htaccess creation logic and improving code coverage, fixes #194
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user