|
@@ 241-260 (lines=20) @@
|
| 238 |
|
DBDatetime::clear_mock_now(); |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
public function testCanBeReviewedFromInheritedSetting() |
| 242 |
|
{ |
| 243 |
|
DBDatetime::set_mock_now("2013-03-01 12:00:00"); |
| 244 |
|
|
| 245 |
|
/** @var Member $author */ |
| 246 |
|
$author = $this->objFromFixture(Member::class, "author"); |
| 247 |
|
|
| 248 |
|
/** @var Page|SiteTreeContentReview $parentPage */ |
| 249 |
|
$parentPage = $this->objFromFixture(Page::class, "contact"); |
| 250 |
|
|
| 251 |
|
$parentPage->NextReviewDate = "2013-01-01"; |
| 252 |
|
$parentPage->write(); |
| 253 |
|
|
| 254 |
|
/** @var Page|SiteTreeContentReview $page */ |
| 255 |
|
$page = $this->objFromFixture(Page::class, "contact-child"); |
| 256 |
|
|
| 257 |
|
$this->assertTrue($page->canBeReviewedBy($author)); |
| 258 |
|
|
| 259 |
|
DBDatetime::clear_mock_now(); |
| 260 |
|
} |
| 261 |
|
|
| 262 |
|
public function testUnModifiedPagesDontChangeEditor() |
| 263 |
|
{ |
|
@@ 295-312 (lines=18) @@
|
| 292 |
|
DBDatetime::clear_mock_now(); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
public function testReviewActionVisibleForAuthor() |
| 296 |
|
{ |
| 297 |
|
DBDatetime::set_mock_now("2020-03-01 12:00:00"); |
| 298 |
|
|
| 299 |
|
/** @var Page|SiteTreeContentReview $page */ |
| 300 |
|
$page = $this->objFromFixture(Page::class, "contact"); |
| 301 |
|
|
| 302 |
|
/** @var Member $author */ |
| 303 |
|
$author = $this->objFromFixture(Member::class, "author"); |
| 304 |
|
|
| 305 |
|
$this->logInAs($author); |
| 306 |
|
|
| 307 |
|
$fields = $page->getCMSActions(); |
| 308 |
|
|
| 309 |
|
$this->assertNotNull($fields->fieldByName("ActionMenus.ReviewContent")); |
| 310 |
|
|
| 311 |
|
DBDatetime::clear_mock_now(); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
public function testReviewActionNotVisibleForEditor() |
| 315 |
|
{ |
|
@@ 314-331 (lines=18) @@
|
| 311 |
|
DBDatetime::clear_mock_now(); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
public function testReviewActionNotVisibleForEditor() |
| 315 |
|
{ |
| 316 |
|
DBDatetime::set_mock_now("2020-03-01 12:00:00"); |
| 317 |
|
|
| 318 |
|
/** @var Page|SiteTreeContentReview $page */ |
| 319 |
|
$page = $this->objFromFixture(Page::class, "contact"); |
| 320 |
|
|
| 321 |
|
/** @var Member $author */ |
| 322 |
|
$author = $this->objFromFixture(Member::class, "editor"); |
| 323 |
|
|
| 324 |
|
$this->logInAs($author); |
| 325 |
|
|
| 326 |
|
$fields = $page->getCMSActions(); |
| 327 |
|
|
| 328 |
|
$this->assertNull($fields->fieldByName("ActionMenus.ReviewContent")); |
| 329 |
|
|
| 330 |
|
DBDatetime::clear_mock_now(); |
| 331 |
|
} |
| 332 |
|
} |
| 333 |
|
|