|
|
|
@ -146,6 +146,7 @@ class modelTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
$this->_model->getPaste(helper::getPasteId())->delete();
|
|
|
|
|
$paste = $this->_model->getPaste();
|
|
|
|
|
$paste->setData($pasteData['data']);
|
|
|
|
|
$paste->setBurnafterreading('0');
|
|
|
|
|
$paste->setOpendiscussion();
|
|
|
|
|
$paste->store();
|
|
|
|
|
|
|
|
|
@ -166,4 +167,45 @@ class modelTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
$this->assertFalse(model_paste::isValidId('foo'), 'invalid hex values');
|
|
|
|
|
$this->assertFalse(model_paste::isValidId('../bar/baz'), 'path attack');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @expectedException Exception
|
|
|
|
|
* @expectedExceptionCode 62
|
|
|
|
|
*/
|
|
|
|
|
public function testInvalidComment()
|
|
|
|
|
{
|
|
|
|
|
$paste = $this->_model->getPaste();
|
|
|
|
|
$comment = $paste->getComment(helper::getPasteId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testExpiration()
|
|
|
|
|
{
|
|
|
|
|
$pasteData = helper::getPaste();
|
|
|
|
|
$this->_model->getPaste(helper::getPasteId())->delete();
|
|
|
|
|
$paste = $this->_model->getPaste(helper::getPasteId());
|
|
|
|
|
$this->assertFalse($paste->exists(), 'paste does not yet exist');
|
|
|
|
|
|
|
|
|
|
$paste = $this->_model->getPaste();
|
|
|
|
|
$paste->setData($pasteData['data']);
|
|
|
|
|
$paste->setExpiration('5min'); // = 300 seconds
|
|
|
|
|
$paste->store();
|
|
|
|
|
|
|
|
|
|
$paste = $paste->get();
|
|
|
|
|
$this->assertEquals(300, $paste->meta->remaining_time, 'remaining time is set correctly');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @expectedException Exception
|
|
|
|
|
* @expectedExceptionCode 64
|
|
|
|
|
*/
|
|
|
|
|
public function testCommentDeletion()
|
|
|
|
|
{
|
|
|
|
|
$pasteData = helper::getPaste();
|
|
|
|
|
$this->_model->getPaste(helper::getPasteId())->delete();
|
|
|
|
|
|
|
|
|
|
$paste = $this->_model->getPaste();
|
|
|
|
|
$paste->setData($pasteData['data']);
|
|
|
|
|
$paste->store();
|
|
|
|
|
$paste->getComment(helper::getPasteId())->delete();
|
|
|
|
|
}
|
|
|
|
|
}
|