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