@@ 744-759 (lines=16) @@ | ||
741 | $this->assertFalse($comment->canCreate()); |
|
742 | } |
|
743 | ||
744 | public function testCanView() |
|
745 | { |
|
746 | $comment = $this->objFromFixture(Comment::class, 'firstComA'); |
|
747 | ||
748 | // admin can view |
|
749 | $this->logInAs('commentadmin'); |
|
750 | $this->assertTrue($comment->canView()); |
|
751 | ||
752 | // visitor can view |
|
753 | $this->logInAs('visitor'); |
|
754 | $this->assertTrue($comment->canView()); |
|
755 | ||
756 | $comment->ParentID = 0; |
|
757 | $comment->write(); |
|
758 | $this->assertFalse($comment->canView()); |
|
759 | } |
|
760 | ||
761 | public function testCanEdit() |
|
762 | { |
|
@@ 761-776 (lines=16) @@ | ||
758 | $this->assertFalse($comment->canView()); |
|
759 | } |
|
760 | ||
761 | public function testCanEdit() |
|
762 | { |
|
763 | $comment = $this->objFromFixture(Comment::class, 'firstComA'); |
|
764 | ||
765 | // admin can edit |
|
766 | $this->logInAs('commentadmin'); |
|
767 | $this->assertTrue($comment->canEdit()); |
|
768 | ||
769 | // visitor cannot |
|
770 | $this->logInAs('visitor'); |
|
771 | $this->assertFalse($comment->canEdit()); |
|
772 | ||
773 | $comment->ParentID = 0; |
|
774 | $comment->write(); |
|
775 | $this->assertFalse($comment->canEdit()); |
|
776 | } |
|
777 | ||
778 | public function testCanDelete() |
|
779 | { |
|
@@ 778-793 (lines=16) @@ | ||
775 | $this->assertFalse($comment->canEdit()); |
|
776 | } |
|
777 | ||
778 | public function testCanDelete() |
|
779 | { |
|
780 | $comment = $this->objFromFixture(Comment::class, 'firstComA'); |
|
781 | ||
782 | // admin can delete |
|
783 | $this->logInAs('commentadmin'); |
|
784 | $this->assertTrue($comment->canDelete()); |
|
785 | ||
786 | // visitor cannot |
|
787 | $this->logInAs('visitor'); |
|
788 | $this->assertFalse($comment->canDelete()); |
|
789 | ||
790 | $comment->ParentID = 0; |
|
791 | $comment->write(); |
|
792 | $this->assertFalse($comment->canDelete()); |
|
793 | } |
|
794 | ||
795 | public function testGetMember() |
|
796 | { |