Code Duplication    Length = 15-15 lines in 3 locations

tests/CommentsTest.php 3 locations

@@ 679-693 (lines=15) @@
676
        $this->assertFalse($comment->canCreate());
677
    }
678
679
    public function testCanView() {
680
        $comment = $this->objFromFixture('Comment', 'firstComA');
681
682
        // admin can view
683
        $this->logInAs('commentadmin');
684
        $this->assertTrue($comment->canView());
685
686
        // visitor can view
687
        $this->logInAs('visitor');
688
        $this->assertTrue($comment->canView());
689
690
        $comment->ParentID = 0;
691
        $comment->write();
692
        $this->assertFalse($comment->canView());
693
    }
694
695
    public function testCanEdit() {
696
        $comment = $this->objFromFixture('Comment', 'firstComA');
@@ 695-709 (lines=15) @@
692
        $this->assertFalse($comment->canView());
693
    }
694
695
    public function testCanEdit() {
696
        $comment = $this->objFromFixture('Comment', 'firstComA');
697
698
        // admin can edit
699
        $this->logInAs('commentadmin');
700
        $this->assertTrue($comment->canEdit());
701
702
        // visitor cannot
703
        $this->logInAs('visitor');
704
        $this->assertFalse($comment->canEdit());
705
706
        $comment->ParentID = 0;
707
        $comment->write();
708
        $this->assertFalse($comment->canEdit());
709
    }
710
711
    public function testCanDelete() {
712
        $comment = $this->objFromFixture('Comment', 'firstComA');
@@ 711-725 (lines=15) @@
708
        $this->assertFalse($comment->canEdit());
709
    }
710
711
    public function testCanDelete() {
712
        $comment = $this->objFromFixture('Comment', 'firstComA');
713
714
        // admin can delete
715
        $this->logInAs('commentadmin');
716
        $this->assertTrue($comment->canDelete());
717
718
        // visitor cannot
719
        $this->logInAs('visitor');
720
        $this->assertFalse($comment->canDelete());
721
722
        $comment->ParentID = 0;
723
        $comment->write();
724
        $this->assertFalse($comment->canDelete());
725
    }
726
727
    public function testGetMember() {
728
        $this->logInAs('visitor');