@@ 722-736 (lines=15) @@ | ||
719 | $this->assertFalse($comment->canCreate()); |
|
720 | } |
|
721 | ||
722 | public function testCanView() |
|
723 | { |
|
724 | $comment = $this->objFromFixture('Comment', 'firstComA'); |
|
725 | ||
726 | // admin can view |
|
727 | $this->logInAs('commentadmin'); |
|
728 | $this->assertTrue($comment->canView()); |
|
729 | ||
730 | // visitor can view |
|
731 | $this->logInAs('visitor'); |
|
732 | $this->assertTrue($comment->canView()); |
|
733 | ||
734 | $comment->ParentID = 0; |
|
735 | $comment->write(); |
|
736 | $this->assertFalse($comment->canView()); |
|
737 | } |
|
738 | ||
739 | public function testCanEdit() |
|
@@ 739-753 (lines=15) @@ | ||
736 | $this->assertFalse($comment->canView()); |
|
737 | } |
|
738 | ||
739 | public function testCanEdit() |
|
740 | { |
|
741 | $comment = $this->objFromFixture('Comment', 'firstComA'); |
|
742 | ||
743 | // admin can edit |
|
744 | $this->logInAs('commentadmin'); |
|
745 | $this->assertTrue($comment->canEdit()); |
|
746 | ||
747 | // visitor cannot |
|
748 | $this->logInAs('visitor'); |
|
749 | $this->assertFalse($comment->canEdit()); |
|
750 | ||
751 | $comment->ParentID = 0; |
|
752 | $comment->write(); |
|
753 | $this->assertFalse($comment->canEdit()); |
|
754 | } |
|
755 | ||
756 | public function testCanDelete() |
|
@@ 756-770 (lines=15) @@ | ||
753 | $this->assertFalse($comment->canEdit()); |
|
754 | } |
|
755 | ||
756 | public function testCanDelete() |
|
757 | { |
|
758 | $comment = $this->objFromFixture('Comment', 'firstComA'); |
|
759 | ||
760 | // admin can delete |
|
761 | $this->logInAs('commentadmin'); |
|
762 | $this->assertTrue($comment->canDelete()); |
|
763 | ||
764 | // visitor cannot |
|
765 | $this->logInAs('visitor'); |
|
766 | $this->assertFalse($comment->canDelete()); |
|
767 | ||
768 | $comment->ParentID = 0; |
|
769 | $comment->write(); |
|
770 | $this->assertFalse($comment->canDelete()); |
|
771 | } |
|
772 | ||
773 | public function testGetMember() |