Code Duplication    Length = 19-21 lines in 4 locations

tests/BlogCategoryTest.php 2 locations

@@ 98-118 (lines=21) @@
95
    /**
96
     * The first blog can be viewed by anybody.
97
     */
98
    public function testCanEdit()
99
    {
100
        $this->useDraftSite();
101
102
        $admin = $this->objFromFixture('Member', 'Admin');
103
        $editor = $this->objFromFixture('Member', 'Editor');
104
105
        $category = $this->objFromFixture('BlogCategory', 'FirstCategory');
106
107
        $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.');
108
        $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.');
109
110
        $category = $this->objFromFixture('BlogCategory', 'SecondCategory');
111
112
        $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.');
113
        $this->assertFalse($category->canEdit($editor), 'Editor should not be able to edit category.');
114
115
        $category = $this->objFromFixture('BlogCategory', 'ThirdCategory');
116
117
        $this->assertTrue($category->canEdit($admin), 'Admin should always be able to edit category.');
118
        $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.');
119
    }
120
121
    public function testCanCreate()
@@ 134-152 (lines=19) @@
131
        $this->assertTrue($category->canCreate($editor), 'Editor should be able to create category.');
132
    }
133
134
    public function testCanDelete()
135
    {
136
        $this->useDraftSite();
137
138
        $admin = $this->objFromFixture('Member', 'Admin');
139
        $editor = $this->objFromFixture('Member', 'Editor');
140
141
        $category = $this->objFromFixture('BlogCategory', 'FirstCategory');
142
143
        $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.');
144
        $this->assertTrue($category->canDelete($editor), 'Editor should be able to category category.');
145
146
        $category = $this->objFromFixture('BlogCategory', 'SecondCategory');
147
        $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.');
148
        $this->assertFalse($category->canDelete($editor), 'Editor should not be able to delete category.');
149
150
        $category = $this->objFromFixture('BlogCategory', 'ThirdCategory');
151
        $this->assertTrue($category->canDelete($admin), 'Admin should always be able to delete category.');
152
        $this->assertTrue($category->canDelete($editor), 'Editor should be able to delete category.');
153
    }
154
155
    public function testDuplicateCategories()

tests/BlogTagTest.php 2 locations

@@ 104-124 (lines=21) @@
101
        $this->assertFalse($tag->canView($editor), 'Editor should not be able to view tag.');
102
    }
103
104
    public function testCanEdit()
105
    {
106
        $this->useDraftSite();
107
108
        $admin = $this->objFromFixture('Member', 'Admin');
109
        $editor = $this->objFromFixture('Member', 'Editor');
110
111
        $tag = $this->objFromFixture('BlogTag', 'FirstTag');
112
113
        $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.');
114
        $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.');
115
116
        $tag = $this->objFromFixture('BlogTag', 'SecondTag');
117
118
        $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.');
119
        $this->assertFalse($tag->canEdit($editor), 'Editor should not be able to edit tag.');
120
121
        $tag = $this->objFromFixture('BlogTag', 'ThirdTag');
122
123
        $this->assertTrue($tag->canEdit($admin), 'Admin should always be able to edit tags.');
124
        $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.');
125
    }
126
127
    public function testCanCreate()
@@ 140-160 (lines=21) @@
137
        $this->assertTrue($tag->canCreate($editor), 'Editor should be able to create tag.');
138
    }
139
140
    public function testCanDelete()
141
    {
142
        $this->useDraftSite();
143
144
        $admin = $this->objFromFixture('Member', 'Admin');
145
        $editor = $this->objFromFixture('Member', 'Editor');
146
147
        $tag = $this->objFromFixture('BlogTag', 'FirstTag');
148
149
        $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.');
150
        $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.');
151
152
        $tag = $this->objFromFixture('BlogTag', 'SecondTag');
153
154
        $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.');
155
        $this->assertFalse($tag->canDelete($editor), 'Editor should not be able to delete tag.');
156
157
        $tag = $this->objFromFixture('BlogTag', 'ThirdTag');
158
159
        $this->assertTrue($tag->canDelete($admin), 'Admin should always be able to delete tags.');
160
        $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.');
161
    }
162
163
    public function testDuplicateTagsForURLSegment()