From 6bc90f50af611a1674ee1118587feddd4f625d44 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 7 May 2017 16:56:20 +0200 Subject: [PATCH] History: fix entries order --- application/api/controllers/History.php | 1 - tests/utils/ReferenceHistory.php | 30 ++++++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php index da034eb..2ff9dea 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/History.php @@ -29,7 +29,6 @@ class History extends ApiController public function getHistory($request, $response) { $history = $this->history->getHistory(); - $history = array_reverse($history); // Return history operations from the {offset}th, starting from {since}. $since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getParam('since')); diff --git a/tests/utils/ReferenceHistory.php b/tests/utils/ReferenceHistory.php index 2028477..75cbb32 100644 --- a/tests/utils/ReferenceHistory.php +++ b/tests/utils/ReferenceHistory.php @@ -15,8 +15,19 @@ class ReferenceHistory public function __construct() { $this->addEntry( - History::CREATED, - DateTime::createFromFormat('Ymd_His', '20170101_121212'), + History::DELETED, + DateTime::createFromFormat('Ymd_His', '20170303_121216'), + 124 + ); + + $this->addEntry( + History::SETTINGS, + DateTime::createFromFormat('Ymd_His', '20170302_121215') + ); + + $this->addEntry( + History::UPDATED, + DateTime::createFromFormat('Ymd_His', '20170301_121214'), 123 ); @@ -27,21 +38,10 @@ class ReferenceHistory ); $this->addEntry( - History::UPDATED, - DateTime::createFromFormat('Ymd_His', '20170301_121214'), + History::CREATED, + DateTime::createFromFormat('Ymd_His', '20170101_121212'), 123 ); - - $this->addEntry( - History::SETTINGS, - DateTime::createFromFormat('Ymd_His', '20170302_121215') - ); - - $this->addEntry( - History::DELETED, - DateTime::createFromFormat('Ymd_His', '20170303_121216'), - 124 - ); } /**