silverstripe-cms/tests/CommentAdminTest.php
Ingo Schommer e43a2409cd ENHANCEMENT Added PageComment->canView()/canEdit()/canDelete(), and using these permissions in PageCommentInterface. Caution: canCreate() actions are still determined by PageCommentInterface::$comments_require_login/$comments_require_permission
BUGFIX Requiring CMS_ACCESS_CommentAdmin instead of ADMIN permissions in PageCommentInterface and CommentAdmin administrative actions (from r104968)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112459 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 01:45:05 +00:00

39 lines
858 B
PHP

<?php
class CommentAdminTest extends FunctionalTest {
static $fixture_file = 'cms/tests/CMSMainTest.yml';
function testNumModerated() {
$comm = new CommentAdmin();
$resp = $comm->NumModerated();
$this->assertEquals(1, $resp);
}
function testNumUnmoderated(){
$comm = new CommentAdmin();
$resp = $comm->NumUnmoderated();
$this->assertEquals(2, $resp);
}
function testNumSpam(){
$comm = new CommentAdmin();
$resp = $comm->NumSpam();
$this->assertEquals(0, $resp);
}
function testdeletemarked(){
$comm = $this->objFromFixture('PageComment', 'Comment1');
$id = $comm->ID;
$this->logInWithPermission('CMS_ACCESS_CommentAdmin');
$result = $this->get("admin/comments/EditForm/field/Comments/item/$id/delete");
$checkComm = DataObject::get_by_id('PageComment',$id);
$this->assertFalse($checkComm);
}
}
?>