2019-01-23 16:37:05 +00:00
|
|
|
<?php
|
|
|
|
namespace ActivityPub\Test\TestUtils;
|
|
|
|
|
2019-02-07 03:48:00 +00:00
|
|
|
use ActivityPub\Entities\ActivityPubObject;
|
2019-01-23 16:37:05 +00:00
|
|
|
use ActivityPub\Entities\Field;
|
|
|
|
use ActivityPub\Test\TestUtils\TestActivityPubObject;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like a Field, but with fixed timestamps for testing
|
|
|
|
*/
|
|
|
|
class TestField extends Field
|
|
|
|
{
|
|
|
|
private $fixedTime;
|
|
|
|
|
|
|
|
protected function __construct( $time = null )
|
|
|
|
{
|
|
|
|
if ( ! $time ) {
|
|
|
|
$time = TestActivityPubObject::getDefaultTime();
|
|
|
|
}
|
|
|
|
parent::__construct( $time );
|
|
|
|
$this->fixedTime = $time;
|
|
|
|
}
|
|
|
|
|
2019-02-07 03:48:00 +00:00
|
|
|
public function setTargetObject( ActivityPubObject $targetObject, $time = null )
|
2019-01-23 16:37:05 +00:00
|
|
|
{
|
|
|
|
parent::setTargetObject( $targetObject, $time );
|
|
|
|
$this->lastUpdated = $this->fixedTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setValue( $value, $time = null )
|
|
|
|
{
|
|
|
|
parent::setValue( $value, $time );
|
|
|
|
$this->lastUpdated = $this->fixedTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function setCreated( $timestamp )
|
|
|
|
{
|
|
|
|
// don't set created
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function setLastupdated( $timestamp )
|
|
|
|
{
|
|
|
|
// don't set lastUpdated
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-02-07 03:48:00 +00:00
|
|
|
|