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