aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2018-12-02 23:24:58 +0100
committerVirtualTam <virtualtam@flibidi.net>2019-01-12 22:47:48 +0100
commitbdc5152d486ca75372c271f94623b248bc127800 (patch)
tree45012b55c96215f83dc863882717822ce5aa9e25 /tests/api/controllers
parent1826e383ecf501302974132fd443cf1ca06e10f6 (diff)
downloadShaarli-bdc5152d486ca75372c271f94623b248bc127800.tar.gz
Shaarli-bdc5152d486ca75372c271f94623b248bc127800.tar.zst
Shaarli-bdc5152d486ca75372c271f94623b248bc127800.zip
namespacing: \Shaarli\History
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/api/controllers')
-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
6 files changed, 30 insertions, 30 deletions
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 );