Code Duplication    Length = 15-20 lines in 2 locations

tests/CommentListTest.php 2 locations

@@ 50-64 (lines=15) @@
47
                                $item->Comments()->getForeignClass());
48
	}
49
50
    public function testAddNonComment() {
51
        $item = $this->objFromFixture('CommentableItem', 'first');
52
        $comments = $item->Comments();
53
        $this->assertEquals(4, $comments->count());
54
        $member = Member::get()->first();
55
        try {
56
            $comments->add($member);
57
            $this->fail('Should not have been able to add member to comments');
58
        } catch (InvalidArgumentException $e) {
59
            $this->assertEquals(
60
                'CommentList::add() expecting a Comment object, or ID value',
61
                $e->getMessage()
62
            );
63
        }
64
    }
65
66
	public function testAddComment() {
67
        $item = $this->objFromFixture('CommentableItem', 'first');
@@ 117-136 (lines=20) @@
114
        $this->assertEquals(2, $item->Comments()->count());
115
    }
116
117
    public function testRemoveNonComment() {
118
        $item = $this->objFromFixture('CommentableItem', 'first');
119
        $this->assertEquals(4, $item->Comments()->count());
120
        $comments = $item->Comments();
121
122
        // try and remove a non comment
123
        $member = Member::get()->first();
124
125
126
127
        try {
128
            $comments->remove($member);
129
            $this->fail('Should not have been able to remove member from comments');
130
        } catch (InvalidArgumentException $e) {
131
            $this->assertEquals(
132
                'CommentList::remove() expecting a Comment object, or ID',
133
                $e->getMessage()
134
            );
135
        }
136
    }
137
138
}
139