*/
protected static $testDatastore = 'sandbox/datastore.php';
+ /**
+ * @var string datastore to test write operations
+ */
+ protected static $testHistory = 'sandbox/history.php';
+
/**
* @var ConfigManager instance
*/
*/
protected $linkDB;
+ /**
+ * @var \History instance.
+ */
+ protected $history;
+
/**
* @var Container instance.
*/
$this->refDB = new \ReferenceLinkDB();
$this->refDB->write(self::$testDatastore);
$this->linkDB = new \LinkDB(self::$testDatastore, true, false);
+ $refHistory = new \ReferenceHistory();
+ $refHistory->write(self::$testHistory);
+ $this->history = new \History(self::$testHistory);
$this->container = new Container();
$this->container['conf'] = $this->conf;
$this->container['db'] = $this->linkDB;
+ $this->container['history'] = $this->history;
$this->controller = new Links($this->container);
}
public function tearDown()
{
@unlink(self::$testDatastore);
+ @unlink(self::$testHistory);
}
/**
$this->linkDB = new \LinkDB(self::$testDatastore, true, false);
$this->assertFalse(isset($this->linkDB[$id]));
+
+ $historyEntry = $this->history->getHistory()[0];
+ $this->assertEquals(\History::DELETED, $historyEntry['event']);
+ $this->assertTrue(
+ (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
+ );
+ $this->assertEquals($id, $historyEntry['id']);
}
/**