| @@ 121-132 (lines=12) @@ | ||
| 118 | $this->assertTrue($category->canEdit($editor), 'Editor should be able to edit category.'); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function testCanCreate() |
|
| 122 | { |
|
| 123 | $this->useDraftSite(); |
|
| 124 | ||
| 125 | $admin = $this->objFromFixture(Member::class, 'Admin'); |
|
| 126 | $editor = $this->objFromFixture(Member::class, 'Editor'); |
|
| 127 | ||
| 128 | $category = singleton(BlogCategory::class); |
|
| 129 | ||
| 130 | $this->assertTrue($category->canCreate($admin), 'Admin should be able to create category.'); |
|
| 131 | $this->assertTrue($category->canCreate($editor), 'Editor should be able to create category.'); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function testCanDelete() |
|
| 135 | { |
|
| @@ 91-100 (lines=10) @@ | ||
| 88 | $this->assertNotEmpty($fields->dataFieldByName('Authors')); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function testCanViewFuturePost() |
|
| 92 | { |
|
| 93 | $blogPost = $this->objFromFixture(BlogPost::class, 'NullPublishDate'); |
|
| 94 | ||
| 95 | $editor = $this->objFromFixture(Member::class, 'BlogEditor'); |
|
| 96 | $this->assertTrue($blogPost->canView($editor)); |
|
| 97 | ||
| 98 | $visitor = $this->objFromFixture(Member::class, 'Visitor'); |
|
| 99 | $this->assertFalse($blogPost->canView($visitor)); |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * The purpose of getDate() is to act as a proxy for PublishDate in the default RSS |
|
| @@ 127-138 (lines=12) @@ | ||
| 124 | $this->assertTrue($tag->canEdit($editor), 'Editor should be able to edit tag.'); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function testCanCreate() |
|
| 128 | { |
|
| 129 | $this->useDraftSite(); |
|
| 130 | ||
| 131 | $admin = $this->objFromFixture(Member::class, 'Admin'); |
|
| 132 | $editor = $this->objFromFixture(Member::class, 'Editor'); |
|
| 133 | ||
| 134 | $tag = singleton(BlogTag::class); |
|
| 135 | ||
| 136 | $this->assertTrue($tag->canCreate($admin), 'Admin should be able to create tag.'); |
|
| 137 | $this->assertTrue($tag->canCreate($editor), 'Editor should be able to create tag.'); |
|
| 138 | } |
|
| 139 | ||
| 140 | public function testCanDelete() |
|
| 141 | { |
|