From 4a613c0e02457e25e17956ec5d243c796632afef Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 4 Oct 2010 05:42:32 +0000 Subject: [PATCH] ENHANCEMENT: added new PageCommnet to yml so we have different amounts of moderated/unmodereated BUGFIX: really testing deletemarked now. (from r99679) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111614 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/CMSMainTest.yml | 8 +++++++- tests/CommentAdminTest.php | 13 ++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/CMSMainTest.yml b/tests/CMSMainTest.yml index 088d3596..0f09a7ff 100644 --- a/tests/CMSMainTest.yml +++ b/tests/CMSMainTest.yml @@ -64,6 +64,7 @@ SiteConfig_CreateTopLevelGroups: GroupID: =>Group.rooteditusers PageComment: Comment1: + ID: 8 Name: Person Comment: Very cool page NeedsModeration: 1 @@ -72,4 +73,9 @@ PageComment: Name: Someone Comment: I am a person NeedsModeration: 0 - EmailAddress: someone@somewhere.com \ No newline at end of file + EmailAddress: someone@somewhere.com + Comment3: + Name: Me + Comment: I like this comment + NeedsModeration: 1 + EmailAddress: me@test.co.nz \ No newline at end of file diff --git a/tests/CommentAdminTest.php b/tests/CommentAdminTest.php index f534a41d..5eebdc4a 100644 --- a/tests/CommentAdminTest.php +++ b/tests/CommentAdminTest.php @@ -15,7 +15,7 @@ class CommentAdminTest extends FunctionalTest { $comm = new CommentAdmin(); $resp = $comm->NumUnmoderated(); - $this->assertEquals(1, $resp); + $this->assertEquals(2, $resp); } function testNumSpam(){ @@ -25,11 +25,14 @@ class CommentAdminTest extends FunctionalTest { $this->assertEquals(0, $resp); } - function testacceptmarked(){ - $id = $this->idFromFixture('PageComment', 'Comment1'); + function testdeletemarked(){ + $comm = $this->objFromFixture('PageComment', 'Comment1'); + $id = $comm->ID; $this->logInWithPermission('ADMIN'); - $result = $this->get('admin/comments/EditForm/field/Comments/item/2/delete'); - $this->assertEquals(200, $result->getStatusCode()); + $result = $this->get("admin/comments/EditForm/field/Comments/item/$id/delete"); + $checkComm = DataObject::get_by_id('PageComment',$id); + + $this->assertEquals(0, $checkComm->ID); } }