aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/History.php13
-rw-r--r--application/NetscapeBookmarkUtils.php1
-rw-r--r--application/api/controllers/ApiController.php2
-rw-r--r--index.php1
-rw-r--r--tests/HistoryTest.php7
-rw-r--r--tests/NetscapeBookmarkUtils/BookmarkImportTest.php1
-rw-r--r--tests/api/controllers/history/HistoryTest.php20
-rw-r--r--tests/api/controllers/links/DeleteLinkTest.php6
-rw-r--r--tests/api/controllers/links/PostLinkTest.php8
-rw-r--r--tests/api/controllers/links/PutLinkTest.php8
-rw-r--r--tests/api/controllers/tags/DeleteTagTest.php10
-rw-r--r--tests/api/controllers/tags/PutTagTest.php8
-rw-r--r--tests/utils/ReferenceHistory.php2
13 files changed, 50 insertions, 37 deletions
diff --git a/application/History.php b/application/History.php
index 35ec016a..8074a017 100644
--- a/application/History.php
+++ b/application/History.php
@@ -1,4 +1,9 @@
1<?php 1<?php
2namespace Shaarli;
3
4use DateTime;
5use Exception;
6use FileUtils;
2 7
3/** 8/**
4 * Class History 9 * Class History
@@ -141,7 +146,7 @@ class History
141 * Save a new event and write it in the history file. 146 * Save a new event and write it in the history file.
142 * 147 *
143 * @param string $status Event key, should be defined as constant. 148 * @param string $status Event key, should be defined as constant.
144 * @param mixed $id Event item identifier (e.g. link ID). 149 * @param mixed $id Event item identifier (e.g. link ID).
145 */ 150 */
146 protected function addEvent($status, $id = null) 151 protected function addEvent($status, $id = null)
147 { 152 {
@@ -166,11 +171,11 @@ class History
166 */ 171 */
167 protected function check() 172 protected function check()
168 { 173 {
169 if (! is_file($this->historyFilePath)) { 174 if (!is_file($this->historyFilePath)) {
170 FileUtils::writeFlatDB($this->historyFilePath, []); 175 FileUtils::writeFlatDB($this->historyFilePath, []);
171 } 176 }
172 177
173 if (! is_writable($this->historyFilePath)) { 178 if (!is_writable($this->historyFilePath)) {
174 throw new Exception(t('History file isn\'t readable or writable')); 179 throw new Exception(t('History file isn\'t readable or writable'));
175 } 180 }
176 } 181 }
@@ -191,7 +196,7 @@ class History
191 */ 196 */
192 protected function write() 197 protected function write()
193 { 198 {
194 $comparaison = new DateTime('-'. $this->retentionTime . ' seconds'); 199 $comparaison = new DateTime('-' . $this->retentionTime . ' seconds');
195 foreach ($this->history as $key => $value) { 200 foreach ($this->history as $key => $value) {
196 if ($value['datetime'] < $comparaison) { 201 if ($value['datetime'] < $comparaison) {
197 unset($this->history[$key]); 202 unset($this->history[$key]);
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index 84dd2b20..c0c007ea 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -2,6 +2,7 @@
2 2
3use Psr\Log\LogLevel; 3use Psr\Log\LogLevel;
4use Shaarli\Config\ConfigManager; 4use Shaarli\Config\ConfigManager;
5use Shaarli\History;
5use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser; 6use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser;
6use Katzgrau\KLogger\Logger; 7use Katzgrau\KLogger\Logger;
7 8
diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php
index 9edefcf6..47e0e178 100644
--- a/application/api/controllers/ApiController.php
+++ b/application/api/controllers/ApiController.php
@@ -30,7 +30,7 @@ abstract class ApiController
30 protected $linkDb; 30 protected $linkDb;
31 31
32 /** 32 /**
33 * @var \History 33 * @var \Shaarli\History
34 */ 34 */
35 protected $history; 35 protected $history;
36 36
diff --git a/index.php b/index.php
index acfcc660..cc41d80c 100644
--- a/index.php
+++ b/index.php
@@ -76,6 +76,7 @@ require_once 'application/PluginManager.php';
76require_once 'application/Router.php'; 76require_once 'application/Router.php';
77require_once 'application/Updater.php'; 77require_once 'application/Updater.php';
78use \Shaarli\Config\ConfigManager; 78use \Shaarli\Config\ConfigManager;
79use Shaarli\History;
79use \Shaarli\Languages; 80use \Shaarli\Languages;
80use \Shaarli\Security\LoginManager; 81use \Shaarli\Security\LoginManager;
81use \Shaarli\Security\SessionManager; 82use \Shaarli\Security\SessionManager;
diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php
index d3bef5a3..7723c461 100644
--- a/tests/HistoryTest.php
+++ b/tests/HistoryTest.php
@@ -1,9 +1,12 @@
1<?php 1<?php
2 2
3require_once 'application/History.php'; 3namespace Shaarli;
4 4
5use DateTime;
6use Exception;
7use FileUtils;
5 8
6class HistoryTest extends PHPUnit_Framework_TestCase 9class HistoryTest extends \PHPUnit\Framework\TestCase
7{ 10{
8 /** 11 /**
9 * @var string History file path 12 * @var string History file path
diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
index f0a958cb..07411c85 100644
--- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
+++ b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php
@@ -3,6 +3,7 @@
3require_once 'application/NetscapeBookmarkUtils.php'; 3require_once 'application/NetscapeBookmarkUtils.php';
4 4
5use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
6use Shaarli\History;
6 7
7/** 8/**
8 * Utility function to load a file's metadata in a $_FILES-like array 9 * Utility function to load a file's metadata in a $_FILES-like array
diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php
index ff34e16d..24efee89 100644
--- a/tests/api/controllers/history/HistoryTest.php
+++ b/tests/api/controllers/history/HistoryTest.php
@@ -49,7 +49,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
49 $this->container = new Container(); 49 $this->container = new Container();
50 $this->container['conf'] = $this->conf; 50 $this->container['conf'] = $this->conf;
51 $this->container['db'] = true; 51 $this->container['db'] = true;
52 $this->container['history'] = new \History(self::$testHistory); 52 $this->container['history'] = new \Shaarli\History(self::$testHistory);
53 53
54 $this->controller = new History($this->container); 54 $this->controller = new History($this->container);
55 } 55 }
@@ -78,35 +78,35 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
78 78
79 $this->assertEquals($this->refHistory->count(), count($data)); 79 $this->assertEquals($this->refHistory->count(), count($data));
80 80
81 $this->assertEquals(\History::DELETED, $data[0]['event']); 81 $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
82 $this->assertEquals( 82 $this->assertEquals(
83 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), 83 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
84 $data[0]['datetime'] 84 $data[0]['datetime']
85 ); 85 );
86 $this->assertEquals(124, $data[0]['id']); 86 $this->assertEquals(124, $data[0]['id']);
87 87
88 $this->assertEquals(\History::SETTINGS, $data[1]['event']); 88 $this->assertEquals(\Shaarli\History::SETTINGS, $data[1]['event']);
89 $this->assertEquals( 89 $this->assertEquals(
90 \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), 90 \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM),
91 $data[1]['datetime'] 91 $data[1]['datetime']
92 ); 92 );
93 $this->assertNull($data[1]['id']); 93 $this->assertNull($data[1]['id']);
94 94
95 $this->assertEquals(\History::UPDATED, $data[2]['event']); 95 $this->assertEquals(\Shaarli\History::UPDATED, $data[2]['event']);
96 $this->assertEquals( 96 $this->assertEquals(
97 \DateTime::createFromFormat('Ymd_His', '20170301_121214')->format(\DateTime::ATOM), 97 \DateTime::createFromFormat('Ymd_His', '20170301_121214')->format(\DateTime::ATOM),
98 $data[2]['datetime'] 98 $data[2]['datetime']
99 ); 99 );
100 $this->assertEquals(123, $data[2]['id']); 100 $this->assertEquals(123, $data[2]['id']);
101 101
102 $this->assertEquals(\History::CREATED, $data[3]['event']); 102 $this->assertEquals(\Shaarli\History::CREATED, $data[3]['event']);
103 $this->assertEquals( 103 $this->assertEquals(
104 \DateTime::createFromFormat('Ymd_His', '20170201_121214')->format(\DateTime::ATOM), 104 \DateTime::createFromFormat('Ymd_His', '20170201_121214')->format(\DateTime::ATOM),
105 $data[3]['datetime'] 105 $data[3]['datetime']
106 ); 106 );
107 $this->assertEquals(124, $data[3]['id']); 107 $this->assertEquals(124, $data[3]['id']);
108 108
109 $this->assertEquals(\History::CREATED, $data[4]['event']); 109 $this->assertEquals(\Shaarli\History::CREATED, $data[4]['event']);
110 $this->assertEquals( 110 $this->assertEquals(
111 \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), 111 \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM),
112 $data[4]['datetime'] 112 $data[4]['datetime']
@@ -131,7 +131,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
131 131
132 $this->assertEquals(1, count($data)); 132 $this->assertEquals(1, count($data));
133 133
134 $this->assertEquals(\History::DELETED, $data[0]['event']); 134 $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
135 $this->assertEquals( 135 $this->assertEquals(
136 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), 136 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
137 $data[0]['datetime'] 137 $data[0]['datetime']
@@ -156,7 +156,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
156 156
157 $this->assertEquals(1, count($data)); 157 $this->assertEquals(1, count($data));
158 158
159 $this->assertEquals(\History::CREATED, $data[0]['event']); 159 $this->assertEquals(\Shaarli\History::CREATED, $data[0]['event']);
160 $this->assertEquals( 160 $this->assertEquals(
161 \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM), 161 \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM),
162 $data[0]['datetime'] 162 $data[0]['datetime']
@@ -181,7 +181,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
181 181
182 $this->assertEquals(1, count($data)); 182 $this->assertEquals(1, count($data));
183 183
184 $this->assertEquals(\History::DELETED, $data[0]['event']); 184 $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
185 $this->assertEquals( 185 $this->assertEquals(
186 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM), 186 \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
187 $data[0]['datetime'] 187 $data[0]['datetime']
@@ -206,7 +206,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
206 206
207 $this->assertEquals(1, count($data)); 207 $this->assertEquals(1, count($data));
208 208
209 $this->assertEquals(\History::SETTINGS, $data[0]['event']); 209 $this->assertEquals(\Shaarli\History::SETTINGS, $data[0]['event']);
210 $this->assertEquals( 210 $this->assertEquals(
211 \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM), 211 \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM),
212 $data[0]['datetime'] 212 $data[0]['datetime']
diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php
index 7d797137..07371e7a 100644
--- a/tests/api/controllers/links/DeleteLinkTest.php
+++ b/tests/api/controllers/links/DeleteLinkTest.php
@@ -37,7 +37,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
37 protected $linkDB; 37 protected $linkDB;
38 38
39 /** 39 /**
40 * @var \History instance. 40 * @var \Shaarli\History instance.
41 */ 41 */
42 protected $history; 42 protected $history;
43 43
@@ -62,7 +62,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
62 $this->linkDB = new \LinkDB(self::$testDatastore, true, false); 62 $this->linkDB = new \LinkDB(self::$testDatastore, true, false);
63 $refHistory = new \ReferenceHistory(); 63 $refHistory = new \ReferenceHistory();
64 $refHistory->write(self::$testHistory); 64 $refHistory->write(self::$testHistory);
65 $this->history = new \History(self::$testHistory); 65 $this->history = new \Shaarli\History(self::$testHistory);
66 $this->container = new Container(); 66 $this->container = new Container();
67 $this->container['conf'] = $this->conf; 67 $this->container['conf'] = $this->conf;
68 $this->container['db'] = $this->linkDB; 68 $this->container['db'] = $this->linkDB;
@@ -100,7 +100,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
100 $this->assertFalse(isset($this->linkDB[$id])); 100 $this->assertFalse(isset($this->linkDB[$id]));
101 101
102 $historyEntry = $this->history->getHistory()[0]; 102 $historyEntry = $this->history->getHistory()[0];
103 $this->assertEquals(\History::DELETED, $historyEntry['event']); 103 $this->assertEquals(\Shaarli\History::DELETED, $historyEntry['event']);
104 $this->assertTrue( 104 $this->assertTrue(
105 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 105 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
106 ); 106 );
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php
index 5c2b5623..a73f443c 100644
--- a/tests/api/controllers/links/PostLinkTest.php
+++ b/tests/api/controllers/links/PostLinkTest.php
@@ -40,7 +40,7 @@ class PostLinkTest extends TestCase
40 protected $refDB = null; 40 protected $refDB = null;
41 41
42 /** 42 /**
43 * @var \History instance. 43 * @var \Shaarli\History instance.
44 */ 44 */
45 protected $history; 45 protected $history;
46 46
@@ -70,12 +70,12 @@ class PostLinkTest extends TestCase
70 70
71 $refHistory = new \ReferenceHistory(); 71 $refHistory = new \ReferenceHistory();
72 $refHistory->write(self::$testHistory); 72 $refHistory->write(self::$testHistory);
73 $this->history = new \History(self::$testHistory); 73 $this->history = new \Shaarli\History(self::$testHistory);
74 74
75 $this->container = new Container(); 75 $this->container = new Container();
76 $this->container['conf'] = $this->conf; 76 $this->container['conf'] = $this->conf;
77 $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); 77 $this->container['db'] = new \LinkDB(self::$testDatastore, true, false);
78 $this->container['history'] = new \History(self::$testHistory); 78 $this->container['history'] = new \Shaarli\History(self::$testHistory);
79 79
80 $this->controller = new Links($this->container); 80 $this->controller = new Links($this->container);
81 81
@@ -133,7 +133,7 @@ class PostLinkTest extends TestCase
133 $this->assertEquals('', $data['updated']); 133 $this->assertEquals('', $data['updated']);
134 134
135 $historyEntry = $this->history->getHistory()[0]; 135 $historyEntry = $this->history->getHistory()[0];
136 $this->assertEquals(\History::CREATED, $historyEntry['event']); 136 $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']);
137 $this->assertTrue( 137 $this->assertTrue(
138 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 138 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
139 ); 139 );
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php
index f276b4c1..3bb4d43f 100644
--- a/tests/api/controllers/links/PutLinkTest.php
+++ b/tests/api/controllers/links/PutLinkTest.php
@@ -32,7 +32,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
32 protected $refDB = null; 32 protected $refDB = null;
33 33
34 /** 34 /**
35 * @var \History instance. 35 * @var \Shaarli\History instance.
36 */ 36 */
37 protected $history; 37 protected $history;
38 38
@@ -62,12 +62,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
62 62
63 $refHistory = new \ReferenceHistory(); 63 $refHistory = new \ReferenceHistory();
64 $refHistory->write(self::$testHistory); 64 $refHistory->write(self::$testHistory);
65 $this->history = new \History(self::$testHistory); 65 $this->history = new \Shaarli\History(self::$testHistory);
66 66
67 $this->container = new Container(); 67 $this->container = new Container();
68 $this->container['conf'] = $this->conf; 68 $this->container['conf'] = $this->conf;
69 $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); 69 $this->container['db'] = new \LinkDB(self::$testDatastore, true, false);
70 $this->container['history'] = new \History(self::$testHistory); 70 $this->container['history'] = new \Shaarli\History(self::$testHistory);
71 71
72 $this->controller = new Links($this->container); 72 $this->controller = new Links($this->container);
73 73
@@ -119,7 +119,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
119 ); 119 );
120 120
121 $historyEntry = $this->history->getHistory()[0]; 121 $historyEntry = $this->history->getHistory()[0];
122 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 122 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
123 $this->assertTrue( 123 $this->assertTrue(
124 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 124 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
125 ); 125 );
diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php
index e0787ce2..a1e419cd 100644
--- a/tests/api/controllers/tags/DeleteTagTest.php
+++ b/tests/api/controllers/tags/DeleteTagTest.php
@@ -37,7 +37,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
37 protected $linkDB; 37 protected $linkDB;
38 38
39 /** 39 /**
40 * @var \History instance. 40 * @var \Shaarli\History instance.
41 */ 41 */
42 protected $history; 42 protected $history;
43 43
@@ -62,7 +62,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
62 $this->linkDB = new \LinkDB(self::$testDatastore, true, false); 62 $this->linkDB = new \LinkDB(self::$testDatastore, true, false);
63 $refHistory = new \ReferenceHistory(); 63 $refHistory = new \ReferenceHistory();
64 $refHistory->write(self::$testHistory); 64 $refHistory->write(self::$testHistory);
65 $this->history = new \History(self::$testHistory); 65 $this->history = new \Shaarli\History(self::$testHistory);
66 $this->container = new Container(); 66 $this->container = new Container();
67 $this->container['conf'] = $this->conf; 67 $this->container['conf'] = $this->conf;
68 $this->container['db'] = $this->linkDB; 68 $this->container['db'] = $this->linkDB;
@@ -103,12 +103,12 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
103 103
104 // 2 links affected 104 // 2 links affected
105 $historyEntry = $this->history->getHistory()[0]; 105 $historyEntry = $this->history->getHistory()[0];
106 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 106 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
107 $this->assertTrue( 107 $this->assertTrue(
108 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 108 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
109 ); 109 );
110 $historyEntry = $this->history->getHistory()[1]; 110 $historyEntry = $this->history->getHistory()[1];
111 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 111 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
112 $this->assertTrue( 112 $this->assertTrue(
113 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 113 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
114 ); 114 );
@@ -137,7 +137,7 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
137 $this->assertTrue($tags[strtolower($tagName)] > 0); 137 $this->assertTrue($tags[strtolower($tagName)] > 0);
138 138
139 $historyEntry = $this->history->getHistory()[0]; 139 $historyEntry = $this->history->getHistory()[0];
140 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 140 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
141 $this->assertTrue( 141 $this->assertTrue(
142 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 142 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
143 ); 143 );
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php
index 38017243..c45fa722 100644
--- a/tests/api/controllers/tags/PutTagTest.php
+++ b/tests/api/controllers/tags/PutTagTest.php
@@ -33,7 +33,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
33 protected $refDB = null; 33 protected $refDB = null;
34 34
35 /** 35 /**
36 * @var \History instance. 36 * @var \Shaarli\History instance.
37 */ 37 */
38 protected $history; 38 protected $history;
39 39
@@ -68,7 +68,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
68 68
69 $refHistory = new \ReferenceHistory(); 69 $refHistory = new \ReferenceHistory();
70 $refHistory->write(self::$testHistory); 70 $refHistory->write(self::$testHistory);
71 $this->history = new \History(self::$testHistory); 71 $this->history = new \Shaarli\History(self::$testHistory);
72 72
73 $this->container = new Container(); 73 $this->container = new Container();
74 $this->container['conf'] = $this->conf; 74 $this->container['conf'] = $this->conf;
@@ -113,12 +113,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
113 $this->assertEquals(2, $tags[$newName]); 113 $this->assertEquals(2, $tags[$newName]);
114 114
115 $historyEntry = $this->history->getHistory()[0]; 115 $historyEntry = $this->history->getHistory()[0];
116 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 116 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
117 $this->assertTrue( 117 $this->assertTrue(
118 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 118 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
119 ); 119 );
120 $historyEntry = $this->history->getHistory()[1]; 120 $historyEntry = $this->history->getHistory()[1];
121 $this->assertEquals(\History::UPDATED, $historyEntry['event']); 121 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
122 $this->assertTrue( 122 $this->assertTrue(
123 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 123 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
124 ); 124 );
diff --git a/tests/utils/ReferenceHistory.php b/tests/utils/ReferenceHistory.php
index 75cbb326..f19cdf2f 100644
--- a/tests/utils/ReferenceHistory.php
+++ b/tests/utils/ReferenceHistory.php
@@ -1,5 +1,7 @@
1<?php 1<?php
2 2
3use Shaarli\History;
4
3/** 5/**
4 * Populates a reference history 6 * Populates a reference history
5 */ 7 */