diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 16:56:20 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 17:11:25 +0200 |
commit | 6bc90f50af611a1674ee1118587feddd4f625d44 (patch) | |
tree | f301229c18fc5a3f013e0558078f7807f30ef92c | |
parent | 57ce6dae5d5c737adde277b9d43bafb68101df40 (diff) | |
download | Shaarli-6bc90f50af611a1674ee1118587feddd4f625d44.tar.gz Shaarli-6bc90f50af611a1674ee1118587feddd4f625d44.tar.zst Shaarli-6bc90f50af611a1674ee1118587feddd4f625d44.zip |
History: fix entries order
-rw-r--r-- | application/api/controllers/History.php | 1 | ||||
-rw-r--r-- | tests/utils/ReferenceHistory.php | 22 |
2 files changed, 11 insertions, 12 deletions
diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php index da034eb2..2ff9deaf 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/History.php | |||
@@ -29,7 +29,6 @@ class History extends ApiController | |||
29 | public function getHistory($request, $response) | 29 | public function getHistory($request, $response) |
30 | { | 30 | { |
31 | $history = $this->history->getHistory(); | 31 | $history = $this->history->getHistory(); |
32 | $history = array_reverse($history); | ||
33 | 32 | ||
34 | // Return history operations from the {offset}th, starting from {since}. | 33 | // Return history operations from the {offset}th, starting from {since}. |
35 | $since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getParam('since')); | 34 | $since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getParam('since')); |
diff --git a/tests/utils/ReferenceHistory.php b/tests/utils/ReferenceHistory.php index 20284770..75cbb326 100644 --- a/tests/utils/ReferenceHistory.php +++ b/tests/utils/ReferenceHistory.php | |||
@@ -15,15 +15,14 @@ class ReferenceHistory | |||
15 | public function __construct() | 15 | public function __construct() |
16 | { | 16 | { |
17 | $this->addEntry( | 17 | $this->addEntry( |
18 | History::CREATED, | 18 | History::DELETED, |
19 | DateTime::createFromFormat('Ymd_His', '20170101_121212'), | 19 | DateTime::createFromFormat('Ymd_His', '20170303_121216'), |
20 | 123 | 20 | 124 |
21 | ); | 21 | ); |
22 | 22 | ||
23 | $this->addEntry( | 23 | $this->addEntry( |
24 | History::CREATED, | 24 | History::SETTINGS, |
25 | DateTime::createFromFormat('Ymd_His', '20170201_121214'), | 25 | DateTime::createFromFormat('Ymd_His', '20170302_121215') |
26 | 124 | ||
27 | ); | 26 | ); |
28 | 27 | ||
29 | $this->addEntry( | 28 | $this->addEntry( |
@@ -33,14 +32,15 @@ class ReferenceHistory | |||
33 | ); | 32 | ); |
34 | 33 | ||
35 | $this->addEntry( | 34 | $this->addEntry( |
36 | History::SETTINGS, | 35 | History::CREATED, |
37 | DateTime::createFromFormat('Ymd_His', '20170302_121215') | 36 | DateTime::createFromFormat('Ymd_His', '20170201_121214'), |
37 | 124 | ||
38 | ); | 38 | ); |
39 | 39 | ||
40 | $this->addEntry( | 40 | $this->addEntry( |
41 | History::DELETED, | 41 | History::CREATED, |
42 | DateTime::createFromFormat('Ymd_His', '20170303_121216'), | 42 | DateTime::createFromFormat('Ymd_His', '20170101_121212'), |
43 | 124 | 43 | 123 |
44 | ); | 44 | ); |
45 | } | 45 | } |
46 | 46 | ||