2024-09-18 03:53:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\ContentReview\Tests;
|
|
|
|
|
|
|
|
use Page;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
2024-09-23 04:40:25 +02:00
|
|
|
use SilverStripe\Model\List\ArrayList;
|
2024-09-18 03:53:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mock Page class with canReviewContent method to return false on first call
|
|
|
|
* and true on second call
|
|
|
|
*/
|
|
|
|
class SiteTreeContentReviewTestPage extends Page implements TestOnly
|
|
|
|
{
|
|
|
|
public $ContentReviewType = 'Custom';
|
|
|
|
|
|
|
|
private $i = 0;
|
|
|
|
|
|
|
|
private $reviewer;
|
|
|
|
|
|
|
|
public function setReviewer($reviewer)
|
|
|
|
{
|
|
|
|
$this->reviewer = $reviewer;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function canReviewContent()
|
|
|
|
{
|
|
|
|
$this->i++;
|
|
|
|
return $this->i === 1 ? false : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function NextReviewDate()
|
|
|
|
{
|
|
|
|
return '2020-02-20 12:00:00';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function OwnerUsers()
|
|
|
|
{
|
|
|
|
return ArrayList::create([$this->reviewer]);
|
|
|
|
}
|
|
|
|
}
|