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