Code Duplication    Length = 19-21 lines in 4 locations

tests/BlogCategoryTest.php 2 locations

@@ 86-106 (lines=21) @@
83
    /**
84
     * The first blog can be viewed by anybody.
85
     */
86
    public function testCanEdit()
87
    {
88
        $this->useDraftSite();
89
90
        $admin = $this->objFromFixture('Member', 'Admin');
91
        $editor = $this->objFromFixture('Member', 'Editor');
92
93
        $category = $this->objFromFixture('BlogCategory', 'FirstCategory');
94
95
        $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.');
96
        $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.');
97
98
        $category = $this->objFromFixture('BlogCategory', 'SecondCategory');
99
100
        $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.');
101
        $this->assertFalse($category->canEdit($editor), 'Editor should not be able to edit category.');
102
103
        $category = $this->objFromFixture('BlogCategory', 'ThirdCategory');
104
105
        $this->assertTrue($category->canEdit($admin), 'Admin should always be able to edit category.');
106
        $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.');
107
    }
108
109
    public function testCanCreate()
@@ 122-140 (lines=19) @@
119
        $this->assertTrue($category->canCreate($editor), 'Editor should be able to create category.');
120
    }
121
122
    public function testCanDelete()
123
    {
124
        $this->useDraftSite();
125
126
        $admin = $this->objFromFixture('Member', 'Admin');
127
        $editor = $this->objFromFixture('Member', 'Editor');
128
129
        $category = $this->objFromFixture('BlogCategory', 'FirstCategory');
130
131
        $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.');
132
        $this->assertTrue($category->canDelete($editor), 'Editor should be able to category category.');
133
134
        $category = $this->objFromFixture('BlogCategory', 'SecondCategory');
135
        $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.');
136
        $this->assertFalse($category->canDelete($editor), 'Editor should not be able to delete category.');
137
138
        $category = $this->objFromFixture('BlogCategory', 'ThirdCategory');
139
        $this->assertTrue($category->canDelete($admin), 'Admin should always be able to delete category.');
140
        $this->assertTrue($category->canDelete($editor), 'Editor should be able to delete category.');
141
    }
142
143
    public function testDuplicateCategories() {

tests/BlogTagTest.php 2 locations

@@ 92-112 (lines=21) @@
89
        $this->assertFalse($tag->canView($editor), 'Editor should not be able to view tag.');
90
    }
91
92
    public function testCanEdit()
93
    {
94
        $this->useDraftSite();
95
96
        $admin = $this->objFromFixture('Member', 'Admin');
97
        $editor = $this->objFromFixture('Member', 'Editor');
98
99
        $tag = $this->objFromFixture('BlogTag', 'FirstTag');
100
101
        $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.');
102
        $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.');
103
104
        $tag = $this->objFromFixture('BlogTag', 'SecondTag');
105
106
        $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.');
107
        $this->assertFalse($tag->canEdit($editor), 'Editor should not be able to edit tag.');
108
109
        $tag = $this->objFromFixture('BlogTag', 'ThirdTag');
110
111
        $this->assertTrue($tag->canEdit($admin), 'Admin should always be able to edit tags.');
112
        $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.');
113
    }
114
115
    public function testCanCreate()
@@ 128-148 (lines=21) @@
125
        $this->assertTrue($tag->canCreate($editor), 'Editor should be able to create tag.');
126
    }
127
128
    public function testCanDelete()
129
    {
130
        $this->useDraftSite();
131
132
        $admin = $this->objFromFixture('Member', 'Admin');
133
        $editor = $this->objFromFixture('Member', 'Editor');
134
135
        $tag = $this->objFromFixture('BlogTag', 'FirstTag');
136
137
        $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.');
138
        $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.');
139
140
        $tag = $this->objFromFixture('BlogTag', 'SecondTag');
141
142
        $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.');
143
        $this->assertFalse($tag->canDelete($editor), 'Editor should not be able to delete tag.');
144
145
        $tag = $this->objFromFixture('BlogTag', 'ThirdTag');
146
147
        $this->assertTrue($tag->canDelete($admin), 'Admin should always be able to delete tags.');
148
        $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.');
149
    }
150
151
    public function testDuplicateTagsForURLSegment() {