| @@ 70-90 (lines=21) @@ | ||
| 67 | /** |
|
| 68 | * The first blog can be viewed by anybody. |
|
| 69 | */ |
|
| 70 | public function testCanEdit() |
|
| 71 | { |
|
| 72 | $this->useDraftSite(); |
|
| 73 | ||
| 74 | $admin = $this->objFromFixture('Member', 'Admin'); |
|
| 75 | $editor = $this->objFromFixture('Member', 'Editor'); |
|
| 76 | ||
| 77 | $category = $this->objFromFixture('BlogCategory', 'FirstCategory'); |
|
| 78 | ||
| 79 | $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.'); |
|
| 80 | $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.'); |
|
| 81 | ||
| 82 | $category = $this->objFromFixture('BlogCategory', 'SecondCategory'); |
|
| 83 | ||
| 84 | $this->assertTrue($category->canEdit($admin), 'Admin should be able to edit category.'); |
|
| 85 | $this->assertFalse($category->canEdit($editor), 'Editor should not be able to edit category.'); |
|
| 86 | ||
| 87 | $category = $this->objFromFixture('BlogCategory', 'ThirdCategory'); |
|
| 88 | ||
| 89 | $this->assertTrue($category->canEdit($admin), 'Admin should always be able to edit category.'); |
|
| 90 | $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.'); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function testCanCreate() |
|
| @@ 106-124 (lines=19) @@ | ||
| 103 | $this->assertTrue($category->canCreate($editor), 'Editor should be able to create category.'); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testCanDelete() |
|
| 107 | { |
|
| 108 | $this->useDraftSite(); |
|
| 109 | ||
| 110 | $admin = $this->objFromFixture('Member', 'Admin'); |
|
| 111 | $editor = $this->objFromFixture('Member', 'Editor'); |
|
| 112 | ||
| 113 | $category = $this->objFromFixture('BlogCategory', 'FirstCategory'); |
|
| 114 | ||
| 115 | $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.'); |
|
| 116 | $this->assertTrue($category->canDelete($editor), 'Editor should be able to category category.'); |
|
| 117 | ||
| 118 | $category = $this->objFromFixture('BlogCategory', 'SecondCategory'); |
|
| 119 | $this->assertTrue($category->canDelete($admin), 'Admin should be able to delete category.'); |
|
| 120 | $this->assertFalse($category->canDelete($editor), 'Editor should not be able to delete category.'); |
|
| 121 | ||
| 122 | $category = $this->objFromFixture('BlogCategory', 'ThirdCategory'); |
|
| 123 | $this->assertTrue($category->canDelete($admin), 'Admin should always be able to delete category.'); |
|
| 124 | $this->assertTrue($category->canDelete($editor), 'Editor should be able to delete category.'); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function testDuplicateCategories() { |
|
| @@ 76-96 (lines=21) @@ | ||
| 73 | $this->assertFalse($tag->canView($editor), 'Editor should not be able to view tag.'); |
|
| 74 | } |
|
| 75 | ||
| 76 | public function testCanEdit() |
|
| 77 | { |
|
| 78 | $this->useDraftSite(); |
|
| 79 | ||
| 80 | $admin = $this->objFromFixture('Member', 'Admin'); |
|
| 81 | $editor = $this->objFromFixture('Member', 'Editor'); |
|
| 82 | ||
| 83 | $tag = $this->objFromFixture('BlogTag', 'FirstTag'); |
|
| 84 | ||
| 85 | $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.'); |
|
| 86 | $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.'); |
|
| 87 | ||
| 88 | $tag = $this->objFromFixture('BlogTag', 'SecondTag'); |
|
| 89 | ||
| 90 | $this->assertTrue($tag->canEdit($admin), 'Admin should be able to edit tag.'); |
|
| 91 | $this->assertFalse($tag->canEdit($editor), 'Editor should not be able to edit tag.'); |
|
| 92 | ||
| 93 | $tag = $this->objFromFixture('BlogTag', 'ThirdTag'); |
|
| 94 | ||
| 95 | $this->assertTrue($tag->canEdit($admin), 'Admin should always be able to edit tags.'); |
|
| 96 | $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.'); |
|
| 97 | } |
|
| 98 | ||
| 99 | public function testCanCreate() |
|
| @@ 112-132 (lines=21) @@ | ||
| 109 | $this->assertTrue($tag->canCreate($editor), 'Editor should be able to create tag.'); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function testCanDelete() |
|
| 113 | { |
|
| 114 | $this->useDraftSite(); |
|
| 115 | ||
| 116 | $admin = $this->objFromFixture('Member', 'Admin'); |
|
| 117 | $editor = $this->objFromFixture('Member', 'Editor'); |
|
| 118 | ||
| 119 | $tag = $this->objFromFixture('BlogTag', 'FirstTag'); |
|
| 120 | ||
| 121 | $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.'); |
|
| 122 | $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.'); |
|
| 123 | ||
| 124 | $tag = $this->objFromFixture('BlogTag', 'SecondTag'); |
|
| 125 | ||
| 126 | $this->assertTrue($tag->canDelete($admin), 'Admin should be able to delete tag.'); |
|
| 127 | $this->assertFalse($tag->canDelete($editor), 'Editor should not be able to delete tag.'); |
|
| 128 | ||
| 129 | $tag = $this->objFromFixture('BlogTag', 'ThirdTag'); |
|
| 130 | ||
| 131 | $this->assertTrue($tag->canDelete($admin), 'Admin should always be able to delete tags.'); |
|
| 132 | $this->assertTrue($tag->canDelete($editor), 'Editor should be able to delete tag.'); |
|
| 133 | } |
|
| 134 | ||
| 135 | public function testDuplicateTagsForURLSegment() { |
|