diff options
41 files changed, 98 insertions, 104 deletions
diff --git a/application/Languages.php b/application/Languages.php index b9c5d0e8..5cda802e 100644 --- a/application/Languages.php +++ b/application/Languages.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Shaarli; | 3 | namespace Shaarli; |
4 | 4 | ||
5 | use Gettext\GettextTranslator; | 5 | use Gettext\GettextTranslator; |
6 | use Gettext\Merge; | ||
7 | use Gettext\Translations; | 6 | use Gettext\Translations; |
8 | use Gettext\Translator; | 7 | use Gettext\Translator; |
9 | use Gettext\TranslatorInterface; | 8 | use Gettext\TranslatorInterface; |
diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php index 37ed97a1..a23f98e9 100644 --- a/application/Thumbnailer.php +++ b/application/Thumbnailer.php | |||
@@ -3,9 +3,9 @@ | |||
3 | namespace Shaarli; | 3 | namespace Shaarli; |
4 | 4 | ||
5 | use Shaarli\Config\ConfigManager; | 5 | use Shaarli\Config\ConfigManager; |
6 | use WebThumbnailer\Application\ConfigManager as WTConfigManager; | ||
6 | use WebThumbnailer\Exception\WebThumbnailerException; | 7 | use WebThumbnailer\Exception\WebThumbnailerException; |
7 | use WebThumbnailer\WebThumbnailer; | 8 | use WebThumbnailer\WebThumbnailer; |
8 | use WebThumbnailer\Application\ConfigManager as WTConfigManager; | ||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Class Thumbnailer | 11 | * Class Thumbnailer |
diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index a2101f29..5ffb8c6d 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php | |||
@@ -1,9 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
3 | 3 | ||
4 | use Shaarli\Api\Exceptions\ApiException; | ||
5 | use Shaarli\Api\Exceptions\ApiAuthorizationException; | 4 | use Shaarli\Api\Exceptions\ApiAuthorizationException; |
6 | 5 | use Shaarli\Api\Exceptions\ApiException; | |
7 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
8 | use Slim\Container; | 7 | use Slim\Container; |
9 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
diff --git a/application/api/ApiUtils.php b/application/api/ApiUtils.php index e51b73e1..1824b5d0 100644 --- a/application/api/ApiUtils.php +++ b/application/api/ApiUtils.php | |||
@@ -1,8 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
3 | 3 | ||
4 | use Shaarli\Http\Base64Url; | ||
5 | use Shaarli\Api\Exceptions\ApiAuthorizationException; | 4 | use Shaarli\Api\Exceptions\ApiAuthorizationException; |
5 | use Shaarli\Http\Base64Url; | ||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * REST API utilities | 8 | * REST API utilities |
diff --git a/application/api/controllers/ApiController.php b/application/api/controllers/ApiController.php index cab97dc4..a6e7cbab 100644 --- a/application/api/controllers/ApiController.php +++ b/application/api/controllers/ApiController.php | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
4 | 4 | ||
5 | use Shaarli\Bookmark\LinkDB; | ||
5 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
6 | use \Slim\Container; | 7 | use Slim\Container; |
7 | 8 | ||
8 | /** | 9 | /** |
9 | * Abstract Class ApiController | 10 | * Abstract Class ApiController |
@@ -25,12 +26,12 @@ abstract class ApiController | |||
25 | protected $conf; | 26 | protected $conf; |
26 | 27 | ||
27 | /** | 28 | /** |
28 | * @var \Shaarli\Bookmark\LinkDB | 29 | * @var LinkDB |
29 | */ | 30 | */ |
30 | protected $linkDb; | 31 | protected $linkDb; |
31 | 32 | ||
32 | /** | 33 | /** |
33 | * @var \Shaarli\History | 34 | * @var HistoryController |
34 | */ | 35 | */ |
35 | protected $history; | 36 | protected $history; |
36 | 37 | ||
diff --git a/application/api/controllers/History.php b/application/api/controllers/HistoryController.php index 4582e8b2..9afcfa26 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/HistoryController.php | |||
@@ -14,7 +14,7 @@ use Slim\Http\Response; | |||
14 | * | 14 | * |
15 | * @package Shaarli\Api\Controllers | 15 | * @package Shaarli\Api\Controllers |
16 | */ | 16 | */ |
17 | class History extends ApiController | 17 | class HistoryController extends ApiController |
18 | { | 18 | { |
19 | /** | 19 | /** |
20 | * Service providing operation regarding Shaarli datastore and settings. | 20 | * Service providing operation regarding Shaarli datastore and settings. |
diff --git a/application/api/controllers/Tags.php b/application/api/controllers/Tags.php index 6dd78750..82f3ef74 100644 --- a/application/api/controllers/Tags.php +++ b/application/api/controllers/Tags.php | |||
@@ -4,7 +4,6 @@ namespace Shaarli\Api\Controllers; | |||
4 | 4 | ||
5 | use Shaarli\Api\ApiUtils; | 5 | use Shaarli\Api\ApiUtils; |
6 | use Shaarli\Api\Exceptions\ApiBadParametersException; | 6 | use Shaarli\Api\Exceptions\ApiBadParametersException; |
7 | use Shaarli\Api\Exceptions\ApiLinkNotFoundException; | ||
8 | use Shaarli\Api\Exceptions\ApiTagNotFoundException; | 7 | use Shaarli\Api\Exceptions\ApiTagNotFoundException; |
9 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
10 | use Slim\Http\Response; | 9 | use Slim\Http\Response; |
diff --git a/application/api/exceptions/ApiLinkNotFoundException.php b/application/api/exceptions/ApiLinkNotFoundException.php index c727f4f0..7c2bb56e 100644 --- a/application/api/exceptions/ApiLinkNotFoundException.php +++ b/application/api/exceptions/ApiLinkNotFoundException.php | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Exceptions; | 3 | namespace Shaarli\Api\Exceptions; |
4 | 4 | ||
5 | use Slim\Http\Response; | ||
6 | |||
7 | /** | 5 | /** |
8 | * Class ApiLinkNotFoundException | 6 | * Class ApiLinkNotFoundException |
9 | * | 7 | * |
diff --git a/application/api/exceptions/ApiTagNotFoundException.php b/application/api/exceptions/ApiTagNotFoundException.php index eee152fe..66ace8bf 100644 --- a/application/api/exceptions/ApiTagNotFoundException.php +++ b/application/api/exceptions/ApiTagNotFoundException.php | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Exceptions; | 3 | namespace Shaarli\Api\Exceptions; |
4 | 4 | ||
5 | use Slim\Http\Response; | ||
6 | |||
7 | /** | 5 | /** |
8 | * Class ApiTagNotFoundException | 6 | * Class ApiTagNotFoundException |
9 | * | 7 | * |
diff --git a/application/bookmark/LinkDB.php b/application/bookmark/LinkDB.php index 6041c088..c13a1141 100644 --- a/application/bookmark/LinkDB.php +++ b/application/bookmark/LinkDB.php | |||
@@ -6,7 +6,6 @@ use ArrayAccess; | |||
6 | use Countable; | 6 | use Countable; |
7 | use DateTime; | 7 | use DateTime; |
8 | use Iterator; | 8 | use Iterator; |
9 | use Shaarli\Bookmark\LinkFilter; | ||
10 | use Shaarli\Bookmark\Exception\LinkNotFoundException; | 9 | use Shaarli\Bookmark\Exception\LinkNotFoundException; |
11 | use Shaarli\Exceptions\IOException; | 10 | use Shaarli\Exceptions\IOException; |
12 | use Shaarli\FileUtils; | 11 | use Shaarli\FileUtils; |
diff --git a/application/feed/FeedBuilder.php b/application/feed/FeedBuilder.php index 737a3128..b66f2f91 100644 --- a/application/feed/FeedBuilder.php +++ b/application/feed/FeedBuilder.php | |||
@@ -2,7 +2,6 @@ | |||
2 | namespace Shaarli\Feed; | 2 | namespace Shaarli\Feed; |
3 | 3 | ||
4 | use DateTime; | 4 | use DateTime; |
5 | use Shaarli\Bookmark\LinkDB; | ||
6 | 5 | ||
7 | /** | 6 | /** |
8 | * FeedBuilder class. | 7 | * FeedBuilder class. |
diff --git a/application/netscape/NetscapeBookmarkUtils.php b/application/netscape/NetscapeBookmarkUtils.php index 2bf928c2..2fb1a4a6 100644 --- a/application/netscape/NetscapeBookmarkUtils.php +++ b/application/netscape/NetscapeBookmarkUtils.php | |||
@@ -5,12 +5,12 @@ namespace Shaarli\Netscape; | |||
5 | use DateTime; | 5 | use DateTime; |
6 | use DateTimeZone; | 6 | use DateTimeZone; |
7 | use Exception; | 7 | use Exception; |
8 | use Katzgrau\KLogger\Logger; | ||
8 | use Psr\Log\LogLevel; | 9 | use Psr\Log\LogLevel; |
9 | use Shaarli\Bookmark\LinkDB; | 10 | use Shaarli\Bookmark\LinkDB; |
10 | use Shaarli\Config\ConfigManager; | 11 | use Shaarli\Config\ConfigManager; |
11 | use Shaarli\History; | 12 | use Shaarli\History; |
12 | use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser; | 13 | use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser; |
13 | use Katzgrau\KLogger\Logger; | ||
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Utilities to import and export bookmarks using the Netscape format | 16 | * Utilities to import and export bookmarks using the Netscape format |
diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 1c5b9251..0569b67f 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php | |||
@@ -2,10 +2,10 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Render; | 3 | namespace Shaarli\Render; |
4 | 4 | ||
5 | use Shaarli\ApplicationUtils; | ||
6 | use Exception; | 5 | use Exception; |
7 | use Shaarli\Bookmark\LinkDB; | ||
8 | use RainTPL; | 6 | use RainTPL; |
7 | use Shaarli\ApplicationUtils; | ||
8 | use Shaarli\Bookmark\LinkDB; | ||
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\Thumbnailer; | 10 | use Shaarli\Thumbnailer; |
11 | 11 | ||
diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 89f0ff7f..f12e3516 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php | |||
@@ -2,12 +2,12 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Updater; | 3 | namespace Shaarli\Updater; |
4 | 4 | ||
5 | use Shaarli\ApplicationUtils; | ||
6 | use Exception; | 5 | use Exception; |
7 | use RainTPL; | 6 | use RainTPL; |
8 | use ReflectionClass; | 7 | use ReflectionClass; |
9 | use ReflectionException; | 8 | use ReflectionException; |
10 | use ReflectionMethod; | 9 | use ReflectionMethod; |
10 | use Shaarli\ApplicationUtils; | ||
11 | use Shaarli\Bookmark\LinkDB; | 11 | use Shaarli\Bookmark\LinkDB; |
12 | use Shaarli\Bookmark\LinkFilter; | 12 | use Shaarli\Bookmark\LinkFilter; |
13 | use Shaarli\Config\ConfigJson; | 13 | use Shaarli\Config\ConfigJson; |
diff --git a/tests/LanguagesTest.php b/tests/LanguagesTest.php index 4951e09a..de83f291 100644 --- a/tests/LanguagesTest.php +++ b/tests/LanguagesTest.php | |||
@@ -7,7 +7,7 @@ use Shaarli\Config\ConfigManager; | |||
7 | /** | 7 | /** |
8 | * Class LanguagesTest. | 8 | * Class LanguagesTest. |
9 | */ | 9 | */ |
10 | class LanguagesTest extends \PHPUnit_Framework_TestCase | 10 | class LanguagesTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @var string Config file path (without extension). | 13 | * @var string Config file path (without extension). |
diff --git a/tests/TimeZoneTest.php b/tests/TimeZoneTest.php index 127fdc19..02bf060f 100644 --- a/tests/TimeZoneTest.php +++ b/tests/TimeZoneTest.php | |||
@@ -8,7 +8,7 @@ require_once 'application/TimeZone.php'; | |||
8 | /** | 8 | /** |
9 | * Unitary tests for timezone utilities | 9 | * Unitary tests for timezone utilities |
10 | */ | 10 | */ |
11 | class TimeZoneTest extends PHPUnit_Framework_TestCase | 11 | class TimeZoneTest extends PHPUnit\Framework\TestCase |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | * @var array of timezones | 14 | * @var array of timezones |
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index d0abd996..8225d95a 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php | |||
@@ -10,7 +10,7 @@ require_once 'application/Languages.php'; | |||
10 | /** | 10 | /** |
11 | * Unitary tests for Shaarli utilities | 11 | * Unitary tests for Shaarli utilities |
12 | */ | 12 | */ |
13 | class UtilsTest extends PHPUnit_Framework_TestCase | 13 | class UtilsTest extends PHPUnit\Framework\TestCase |
14 | { | 14 | { |
15 | // Log file | 15 | // Log file |
16 | protected static $testLogFile = 'tests.log'; | 16 | protected static $testLogFile = 'tests.log'; |
diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php index 23a56b1c..0b9b03f2 100644 --- a/tests/api/ApiMiddlewareTest.php +++ b/tests/api/ApiMiddlewareTest.php | |||
@@ -2,7 +2,6 @@ | |||
2 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
3 | 3 | ||
4 | use Shaarli\Config\ConfigManager; | 4 | use Shaarli\Config\ConfigManager; |
5 | |||
6 | use Slim\Container; | 5 | use Slim\Container; |
7 | use Slim\Http\Environment; | 6 | use Slim\Http\Environment; |
8 | use Slim\Http\Request; | 7 | use Slim\Http\Request; |
@@ -18,7 +17,7 @@ use Slim\Http\Response; | |||
18 | * | 17 | * |
19 | * @package Api | 18 | * @package Api |
20 | */ | 19 | */ |
21 | class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase | 20 | class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase |
22 | { | 21 | { |
23 | /** | 22 | /** |
24 | * @var string datastore to test write operations | 23 | * @var string datastore to test write operations |
diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php index a1b623d8..ea0ae500 100644 --- a/tests/api/ApiUtilsTest.php +++ b/tests/api/ApiUtilsTest.php | |||
@@ -7,7 +7,7 @@ use Shaarli\Http\Base64Url; | |||
7 | /** | 7 | /** |
8 | * Class ApiUtilsTest | 8 | * Class ApiUtilsTest |
9 | */ | 9 | */ |
10 | class ApiUtilsTest extends \PHPUnit_Framework_TestCase | 10 | class ApiUtilsTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * Force the timezone for ISO datetimes. | 13 | * Force the timezone for ISO datetimes. |
diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php index 24efee89..e287f239 100644 --- a/tests/api/controllers/history/HistoryTest.php +++ b/tests/api/controllers/history/HistoryTest.php | |||
@@ -1,9 +1,9 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | |||
4 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
5 | 4 | ||
6 | use Shaarli\Config\ConfigManager; | 5 | use Shaarli\Config\ConfigManager; |
6 | use Shaarli\History; | ||
7 | use Slim\Container; | 7 | use Slim\Container; |
8 | use Slim\Http\Environment; | 8 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 9 | use Slim\Http\Request; |
@@ -11,7 +11,7 @@ use Slim\Http\Response; | |||
11 | 11 | ||
12 | require_once 'tests/utils/ReferenceHistory.php'; | 12 | require_once 'tests/utils/ReferenceHistory.php'; |
13 | 13 | ||
14 | class HistoryTest extends \PHPUnit_Framework_TestCase | 14 | class HistoryTest extends \PHPUnit\Framework\TestCase |
15 | { | 15 | { |
16 | /** | 16 | /** |
17 | * @var string datastore to test write operations | 17 | * @var string datastore to test write operations |
@@ -34,7 +34,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase | |||
34 | protected $container; | 34 | protected $container; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * @var History controller instance. | 37 | * @var HistoryController controller instance. |
38 | */ | 38 | */ |
39 | protected $controller; | 39 | protected $controller; |
40 | 40 | ||
@@ -49,9 +49,9 @@ 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 \Shaarli\History(self::$testHistory); | 52 | $this->container['history'] = new History(self::$testHistory); |
53 | 53 | ||
54 | $this->controller = new History($this->container); | 54 | $this->controller = new HistoryController($this->container); |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
@@ -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(\Shaarli\History::DELETED, $data[0]['event']); | 81 | $this->assertEquals(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(\Shaarli\History::SETTINGS, $data[1]['event']); | 88 | $this->assertEquals(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(\Shaarli\History::UPDATED, $data[2]['event']); | 95 | $this->assertEquals(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(\Shaarli\History::CREATED, $data[3]['event']); | 102 | $this->assertEquals(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(\Shaarli\History::CREATED, $data[4]['event']); | 109 | $this->assertEquals(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(\Shaarli\History::DELETED, $data[0]['event']); | 134 | $this->assertEquals(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(\Shaarli\History::CREATED, $data[0]['event']); | 159 | $this->assertEquals(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(\Shaarli\History::DELETED, $data[0]['event']); | 184 | $this->assertEquals(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(\Shaarli\History::SETTINGS, $data[0]['event']); | 209 | $this->assertEquals(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/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php index 44a9382e..e70d371b 100644 --- a/tests/api/controllers/info/InfoTest.php +++ b/tests/api/controllers/info/InfoTest.php | |||
@@ -2,7 +2,6 @@ | |||
2 | namespace Shaarli\Api\Controllers; | 2 | namespace Shaarli\Api\Controllers; |
3 | 3 | ||
4 | use Shaarli\Config\ConfigManager; | 4 | use Shaarli\Config\ConfigManager; |
5 | |||
6 | use Slim\Container; | 5 | use Slim\Container; |
7 | use Slim\Http\Environment; | 6 | use Slim\Http\Environment; |
8 | use Slim\Http\Request; | 7 | use Slim\Http\Request; |
@@ -15,7 +14,7 @@ use Slim\Http\Response; | |||
15 | * | 14 | * |
16 | * @package Api\Controllers | 15 | * @package Api\Controllers |
17 | */ | 16 | */ |
18 | class InfoTest extends \PHPUnit_Framework_TestCase | 17 | class InfoTest extends \PHPUnit\Framework\TestCase |
19 | { | 18 | { |
20 | /** | 19 | /** |
21 | * @var string datastore to test write operations | 20 | * @var string datastore to test write operations |
diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php index adca9a4e..90193e28 100644 --- a/tests/api/controllers/links/DeleteLinkTest.php +++ b/tests/api/controllers/links/DeleteLinkTest.php | |||
@@ -3,13 +3,15 @@ | |||
3 | 3 | ||
4 | namespace Shaarli\Api\Controllers; | 4 | namespace Shaarli\Api\Controllers; |
5 | 5 | ||
6 | use Shaarli\Bookmark\LinkDB; | ||
6 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\History; | ||
7 | use Slim\Container; | 9 | use Slim\Container; |
8 | use Slim\Http\Environment; | 10 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 11 | use Slim\Http\Request; |
10 | use Slim\Http\Response; | 12 | use Slim\Http\Response; |
11 | 13 | ||
12 | class DeleteLinkTest extends \PHPUnit_Framework_TestCase | 14 | class DeleteLinkTest extends \PHPUnit\Framework\TestCase |
13 | { | 15 | { |
14 | /** | 16 | /** |
15 | * @var string datastore to test write operations | 17 | * @var string datastore to test write operations |
@@ -32,12 +34,12 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase | |||
32 | protected $refDB = null; | 34 | protected $refDB = null; |
33 | 35 | ||
34 | /** | 36 | /** |
35 | * @var \Shaarli\Bookmark\LinkDB instance. | 37 | * @var LinkDB instance. |
36 | */ | 38 | */ |
37 | protected $linkDB; | 39 | protected $linkDB; |
38 | 40 | ||
39 | /** | 41 | /** |
40 | * @var \Shaarli\History instance. | 42 | * @var HistoryController instance. |
41 | */ | 43 | */ |
42 | protected $history; | 44 | protected $history; |
43 | 45 | ||
@@ -59,10 +61,10 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase | |||
59 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | 61 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
60 | $this->refDB = new \ReferenceLinkDB(); | 62 | $this->refDB = new \ReferenceLinkDB(); |
61 | $this->refDB->write(self::$testDatastore); | 63 | $this->refDB->write(self::$testDatastore); |
62 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 64 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
63 | $refHistory = new \ReferenceHistory(); | 65 | $refHistory = new \ReferenceHistory(); |
64 | $refHistory->write(self::$testHistory); | 66 | $refHistory->write(self::$testHistory); |
65 | $this->history = new \Shaarli\History(self::$testHistory); | 67 | $this->history = new History(self::$testHistory); |
66 | $this->container = new Container(); | 68 | $this->container = new Container(); |
67 | $this->container['conf'] = $this->conf; | 69 | $this->container['conf'] = $this->conf; |
68 | $this->container['db'] = $this->linkDB; | 70 | $this->container['db'] = $this->linkDB; |
@@ -96,11 +98,11 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase | |||
96 | $this->assertEquals(204, $response->getStatusCode()); | 98 | $this->assertEquals(204, $response->getStatusCode()); |
97 | $this->assertEmpty((string) $response->getBody()); | 99 | $this->assertEmpty((string) $response->getBody()); |
98 | 100 | ||
99 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 101 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
100 | $this->assertFalse(isset($this->linkDB[$id])); | 102 | $this->assertFalse(isset($this->linkDB[$id])); |
101 | 103 | ||
102 | $historyEntry = $this->history->getHistory()[0]; | 104 | $historyEntry = $this->history->getHistory()[0]; |
103 | $this->assertEquals(\Shaarli\History::DELETED, $historyEntry['event']); | 105 | $this->assertEquals(History::DELETED, $historyEntry['event']); |
104 | $this->assertTrue( | 106 | $this->assertTrue( |
105 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 107 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
106 | ); | 108 | ); |
@@ -110,7 +112,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase | |||
110 | /** | 112 | /** |
111 | * Test DELETE link endpoint: reach not existing ID. | 113 | * Test DELETE link endpoint: reach not existing ID. |
112 | * | 114 | * |
113 | * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException | 115 | * @expectedException \Shaarli\Api\Exceptions\ApiLinkNotFoundException |
114 | */ | 116 | */ |
115 | public function testDeleteLink404() | 117 | public function testDeleteLink404() |
116 | { | 118 | { |
diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php index bf58000b..cb9b7f6a 100644 --- a/tests/api/controllers/links/GetLinkIdTest.php +++ b/tests/api/controllers/links/GetLinkIdTest.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
4 | 4 | ||
5 | use Shaarli\Config\ConfigManager; | 5 | use Shaarli\Config\ConfigManager; |
6 | |||
7 | use Slim\Container; | 6 | use Slim\Container; |
8 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -18,7 +17,7 @@ use Slim\Http\Response; | |||
18 | * | 17 | * |
19 | * @package Shaarli\Api\Controllers | 18 | * @package Shaarli\Api\Controllers |
20 | */ | 19 | */ |
21 | class GetLinkIdTest extends \PHPUnit_Framework_TestCase | 20 | class GetLinkIdTest extends \PHPUnit\Framework\TestCase |
22 | { | 21 | { |
23 | /** | 22 | /** |
24 | * @var string datastore to test write operations | 23 | * @var string datastore to test write operations |
diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php index 1008d7b2..711a3152 100644 --- a/tests/api/controllers/links/GetLinksTest.php +++ b/tests/api/controllers/links/GetLinksTest.php | |||
@@ -1,8 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Api\Controllers; | 2 | namespace Shaarli\Api\Controllers; |
3 | 3 | ||
4 | use Shaarli\Bookmark\LinkDB; | ||
4 | use Shaarli\Config\ConfigManager; | 5 | use Shaarli\Config\ConfigManager; |
5 | |||
6 | use Slim\Container; | 6 | use Slim\Container; |
7 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
8 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -17,7 +17,7 @@ use Slim\Http\Response; | |||
17 | * | 17 | * |
18 | * @package Shaarli\Api\Controllers | 18 | * @package Shaarli\Api\Controllers |
19 | */ | 19 | */ |
20 | class GetLinksTest extends \PHPUnit_Framework_TestCase | 20 | class GetLinksTest extends \PHPUnit\Framework\TestCase |
21 | { | 21 | { |
22 | /** | 22 | /** |
23 | * @var string datastore to test write operations | 23 | * @var string datastore to test write operations |
@@ -60,7 +60,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase | |||
60 | 60 | ||
61 | $this->container = new Container(); | 61 | $this->container = new Container(); |
62 | $this->container['conf'] = $this->conf; | 62 | $this->container['conf'] = $this->conf; |
63 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 63 | $this->container['db'] = new LinkDB(self::$testDatastore, true, false); |
64 | $this->container['history'] = null; | 64 | $this->container['history'] = null; |
65 | 65 | ||
66 | $this->controller = new Links($this->container); | 66 | $this->controller = new Links($this->container); |
@@ -114,7 +114,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase | |||
114 | $this->assertEquals('sTuff', $first['tags'][0]); | 114 | $this->assertEquals('sTuff', $first['tags'][0]); |
115 | $this->assertEquals(false, $first['private']); | 115 | $this->assertEquals(false, $first['private']); |
116 | $this->assertEquals( | 116 | $this->assertEquals( |
117 | \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), | 117 | \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), |
118 | $first['created'] | 118 | $first['created'] |
119 | ); | 119 | ); |
120 | $this->assertEmpty($first['updated']); | 120 | $this->assertEmpty($first['updated']); |
@@ -125,7 +125,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase | |||
125 | 125 | ||
126 | // Update date | 126 | // Update date |
127 | $this->assertEquals( | 127 | $this->assertEquals( |
128 | \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), | 128 | \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM), |
129 | $link['updated'] | 129 | $link['updated'] |
130 | ); | 130 | ); |
131 | } | 131 | } |
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 24e591db..d683a984 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php | |||
@@ -4,6 +4,7 @@ namespace Shaarli\Api\Controllers; | |||
4 | 4 | ||
5 | use PHPUnit\Framework\TestCase; | 5 | use PHPUnit\Framework\TestCase; |
6 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
7 | use Shaarli\History; | ||
7 | use Slim\Container; | 8 | use Slim\Container; |
8 | use Slim\Http\Environment; | 9 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 10 | use Slim\Http\Request; |
@@ -40,7 +41,7 @@ class PostLinkTest extends TestCase | |||
40 | protected $refDB = null; | 41 | protected $refDB = null; |
41 | 42 | ||
42 | /** | 43 | /** |
43 | * @var \Shaarli\History instance. | 44 | * @var HistoryController instance. |
44 | */ | 45 | */ |
45 | protected $history; | 46 | protected $history; |
46 | 47 | ||
@@ -70,12 +71,12 @@ class PostLinkTest extends TestCase | |||
70 | 71 | ||
71 | $refHistory = new \ReferenceHistory(); | 72 | $refHistory = new \ReferenceHistory(); |
72 | $refHistory->write(self::$testHistory); | 73 | $refHistory->write(self::$testHistory); |
73 | $this->history = new \Shaarli\History(self::$testHistory); | 74 | $this->history = new History(self::$testHistory); |
74 | 75 | ||
75 | $this->container = new Container(); | 76 | $this->container = new Container(); |
76 | $this->container['conf'] = $this->conf; | 77 | $this->container['conf'] = $this->conf; |
77 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 78 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); |
78 | $this->container['history'] = new \Shaarli\History(self::$testHistory); | 79 | $this->container['history'] = new History(self::$testHistory); |
79 | 80 | ||
80 | $this->controller = new Links($this->container); | 81 | $this->controller = new Links($this->container); |
81 | 82 | ||
@@ -133,7 +134,7 @@ class PostLinkTest extends TestCase | |||
133 | $this->assertEquals('', $data['updated']); | 134 | $this->assertEquals('', $data['updated']); |
134 | 135 | ||
135 | $historyEntry = $this->history->getHistory()[0]; | 136 | $historyEntry = $this->history->getHistory()[0]; |
136 | $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']); | 137 | $this->assertEquals(History::CREATED, $historyEntry['event']); |
137 | $this->assertTrue( | 138 | $this->assertTrue( |
138 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 139 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
139 | ); | 140 | ); |
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php index eb6c7955..cd815b66 100644 --- a/tests/api/controllers/links/PutLinkTest.php +++ b/tests/api/controllers/links/PutLinkTest.php | |||
@@ -4,12 +4,13 @@ | |||
4 | namespace Shaarli\Api\Controllers; | 4 | namespace Shaarli\Api\Controllers; |
5 | 5 | ||
6 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
7 | use Shaarli\History; | ||
7 | use Slim\Container; | 8 | use Slim\Container; |
8 | use Slim\Http\Environment; | 9 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 10 | use Slim\Http\Request; |
10 | use Slim\Http\Response; | 11 | use Slim\Http\Response; |
11 | 12 | ||
12 | class PutLinkTest extends \PHPUnit_Framework_TestCase | 13 | class PutLinkTest extends \PHPUnit\Framework\TestCase |
13 | { | 14 | { |
14 | /** | 15 | /** |
15 | * @var string datastore to test write operations | 16 | * @var string datastore to test write operations |
@@ -32,7 +33,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase | |||
32 | protected $refDB = null; | 33 | protected $refDB = null; |
33 | 34 | ||
34 | /** | 35 | /** |
35 | * @var \Shaarli\History instance. | 36 | * @var HistoryController instance. |
36 | */ | 37 | */ |
37 | protected $history; | 38 | protected $history; |
38 | 39 | ||
@@ -62,12 +63,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase | |||
62 | 63 | ||
63 | $refHistory = new \ReferenceHistory(); | 64 | $refHistory = new \ReferenceHistory(); |
64 | $refHistory->write(self::$testHistory); | 65 | $refHistory->write(self::$testHistory); |
65 | $this->history = new \Shaarli\History(self::$testHistory); | 66 | $this->history = new History(self::$testHistory); |
66 | 67 | ||
67 | $this->container = new Container(); | 68 | $this->container = new Container(); |
68 | $this->container['conf'] = $this->conf; | 69 | $this->container['conf'] = $this->conf; |
69 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 70 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); |
70 | $this->container['history'] = new \Shaarli\History(self::$testHistory); | 71 | $this->container['history'] = new History(self::$testHistory); |
71 | 72 | ||
72 | $this->controller = new Links($this->container); | 73 | $this->controller = new Links($this->container); |
73 | 74 | ||
@@ -119,7 +120,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase | |||
119 | ); | 120 | ); |
120 | 121 | ||
121 | $historyEntry = $this->history->getHistory()[0]; | 122 | $historyEntry = $this->history->getHistory()[0]; |
122 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 123 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
123 | $this->assertTrue( | 124 | $this->assertTrue( |
124 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 125 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
125 | ); | 126 | ); |
diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php index 02803ba2..84e1d56e 100644 --- a/tests/api/controllers/tags/DeleteTagTest.php +++ b/tests/api/controllers/tags/DeleteTagTest.php | |||
@@ -3,13 +3,15 @@ | |||
3 | 3 | ||
4 | namespace Shaarli\Api\Controllers; | 4 | namespace Shaarli\Api\Controllers; |
5 | 5 | ||
6 | use Shaarli\Bookmark\LinkDB; | ||
6 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\History; | ||
7 | use Slim\Container; | 9 | use Slim\Container; |
8 | use Slim\Http\Environment; | 10 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 11 | use Slim\Http\Request; |
10 | use Slim\Http\Response; | 12 | use Slim\Http\Response; |
11 | 13 | ||
12 | class DeleteTagTest extends \PHPUnit_Framework_TestCase | 14 | class DeleteTagTest extends \PHPUnit\Framework\TestCase |
13 | { | 15 | { |
14 | /** | 16 | /** |
15 | * @var string datastore to test write operations | 17 | * @var string datastore to test write operations |
@@ -32,12 +34,12 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase | |||
32 | protected $refDB = null; | 34 | protected $refDB = null; |
33 | 35 | ||
34 | /** | 36 | /** |
35 | * @var \Shaarli\Bookmark\LinkDB instance. | 37 | * @var LinkDB instance. |
36 | */ | 38 | */ |
37 | protected $linkDB; | 39 | protected $linkDB; |
38 | 40 | ||
39 | /** | 41 | /** |
40 | * @var \Shaarli\History instance. | 42 | * @var HistoryController instance. |
41 | */ | 43 | */ |
42 | protected $history; | 44 | protected $history; |
43 | 45 | ||
@@ -59,10 +61,10 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase | |||
59 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | 61 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
60 | $this->refDB = new \ReferenceLinkDB(); | 62 | $this->refDB = new \ReferenceLinkDB(); |
61 | $this->refDB->write(self::$testDatastore); | 63 | $this->refDB->write(self::$testDatastore); |
62 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 64 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
63 | $refHistory = new \ReferenceHistory(); | 65 | $refHistory = new \ReferenceHistory(); |
64 | $refHistory->write(self::$testHistory); | 66 | $refHistory->write(self::$testHistory); |
65 | $this->history = new \Shaarli\History(self::$testHistory); | 67 | $this->history = new History(self::$testHistory); |
66 | $this->container = new Container(); | 68 | $this->container = new Container(); |
67 | $this->container['conf'] = $this->conf; | 69 | $this->container['conf'] = $this->conf; |
68 | $this->container['db'] = $this->linkDB; | 70 | $this->container['db'] = $this->linkDB; |
@@ -97,18 +99,18 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase | |||
97 | $this->assertEquals(204, $response->getStatusCode()); | 99 | $this->assertEquals(204, $response->getStatusCode()); |
98 | $this->assertEmpty((string) $response->getBody()); | 100 | $this->assertEmpty((string) $response->getBody()); |
99 | 101 | ||
100 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 102 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
101 | $tags = $this->linkDB->linksCountPerTag(); | 103 | $tags = $this->linkDB->linksCountPerTag(); |
102 | $this->assertFalse(isset($tags[$tagName])); | 104 | $this->assertFalse(isset($tags[$tagName])); |
103 | 105 | ||
104 | // 2 links affected | 106 | // 2 links affected |
105 | $historyEntry = $this->history->getHistory()[0]; | 107 | $historyEntry = $this->history->getHistory()[0]; |
106 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 108 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
107 | $this->assertTrue( | 109 | $this->assertTrue( |
108 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 110 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
109 | ); | 111 | ); |
110 | $historyEntry = $this->history->getHistory()[1]; | 112 | $historyEntry = $this->history->getHistory()[1]; |
111 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 113 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
112 | $this->assertTrue( | 114 | $this->assertTrue( |
113 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 115 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
114 | ); | 116 | ); |
@@ -131,13 +133,13 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase | |||
131 | $this->assertEquals(204, $response->getStatusCode()); | 133 | $this->assertEquals(204, $response->getStatusCode()); |
132 | $this->assertEmpty((string) $response->getBody()); | 134 | $this->assertEmpty((string) $response->getBody()); |
133 | 135 | ||
134 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 136 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
135 | $tags = $this->linkDB->linksCountPerTag(); | 137 | $tags = $this->linkDB->linksCountPerTag(); |
136 | $this->assertFalse(isset($tags[$tagName])); | 138 | $this->assertFalse(isset($tags[$tagName])); |
137 | $this->assertTrue($tags[strtolower($tagName)] > 0); | 139 | $this->assertTrue($tags[strtolower($tagName)] > 0); |
138 | 140 | ||
139 | $historyEntry = $this->history->getHistory()[0]; | 141 | $historyEntry = $this->history->getHistory()[0]; |
140 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 142 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
141 | $this->assertTrue( | 143 | $this->assertTrue( |
142 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 144 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
143 | ); | 145 | ); |
diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php index 8e0feccd..a2525c17 100644 --- a/tests/api/controllers/tags/GetTagNameTest.php +++ b/tests/api/controllers/tags/GetTagNameTest.php | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
4 | 4 | ||
5 | use Shaarli\Bookmark\LinkDB; | ||
5 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
6 | |||
7 | use Slim\Container; | 7 | use Slim\Container; |
8 | use Slim\Http\Environment; | 8 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 9 | use Slim\Http\Request; |
@@ -16,7 +16,7 @@ use Slim\Http\Response; | |||
16 | * | 16 | * |
17 | * @package Shaarli\Api\Controllers | 17 | * @package Shaarli\Api\Controllers |
18 | */ | 18 | */ |
19 | class GetTagNameTest extends \PHPUnit_Framework_TestCase | 19 | class GetTagNameTest extends \PHPUnit\Framework\TestCase |
20 | { | 20 | { |
21 | /** | 21 | /** |
22 | * @var string datastore to test write operations | 22 | * @var string datastore to test write operations |
@@ -59,7 +59,7 @@ class GetTagNameTest extends \PHPUnit_Framework_TestCase | |||
59 | 59 | ||
60 | $this->container = new Container(); | 60 | $this->container = new Container(); |
61 | $this->container['conf'] = $this->conf; | 61 | $this->container['conf'] = $this->conf; |
62 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 62 | $this->container['db'] = new LinkDB(self::$testDatastore, true, false); |
63 | $this->container['history'] = null; | 63 | $this->container['history'] = null; |
64 | 64 | ||
65 | $this->controller = new Tags($this->container); | 65 | $this->controller = new Tags($this->container); |
diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php index f071bfa8..98628c98 100644 --- a/tests/api/controllers/tags/GetTagsTest.php +++ b/tests/api/controllers/tags/GetTagsTest.php | |||
@@ -1,8 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Api\Controllers; | 2 | namespace Shaarli\Api\Controllers; |
3 | 3 | ||
4 | use Shaarli\Bookmark\LinkDB; | ||
4 | use Shaarli\Config\ConfigManager; | 5 | use Shaarli\Config\ConfigManager; |
5 | |||
6 | use Slim\Container; | 6 | use Slim\Container; |
7 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
8 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -15,7 +15,7 @@ use Slim\Http\Response; | |||
15 | * | 15 | * |
16 | * @package Shaarli\Api\Controllers | 16 | * @package Shaarli\Api\Controllers |
17 | */ | 17 | */ |
18 | class GetTagsTest extends \PHPUnit_Framework_TestCase | 18 | class GetTagsTest extends \PHPUnit\Framework\TestCase |
19 | { | 19 | { |
20 | /** | 20 | /** |
21 | * @var string datastore to test write operations | 21 | * @var string datastore to test write operations |
@@ -38,7 +38,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase | |||
38 | protected $container; | 38 | protected $container; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * @var \Shaarli\Bookmark\LinkDB instance. | 41 | * @var LinkDB instance. |
42 | */ | 42 | */ |
43 | protected $linkDB; | 43 | protected $linkDB; |
44 | 44 | ||
@@ -63,7 +63,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase | |||
63 | 63 | ||
64 | $this->container = new Container(); | 64 | $this->container = new Container(); |
65 | $this->container['conf'] = $this->conf; | 65 | $this->container['conf'] = $this->conf; |
66 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 66 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
67 | $this->container['db'] = $this->linkDB; | 67 | $this->container['db'] = $this->linkDB; |
68 | $this->container['history'] = null; | 68 | $this->container['history'] = null; |
69 | 69 | ||
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index d8c0fec8..86106fc7 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php | |||
@@ -1,16 +1,17 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | |||
4 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
5 | 4 | ||
6 | use Shaarli\Api\Exceptions\ApiBadParametersException; | 5 | use Shaarli\Api\Exceptions\ApiBadParametersException; |
6 | use Shaarli\Bookmark\LinkDB; | ||
7 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\History; | ||
8 | use Slim\Container; | 9 | use Slim\Container; |
9 | use Slim\Http\Environment; | 10 | use Slim\Http\Environment; |
10 | use Slim\Http\Request; | 11 | use Slim\Http\Request; |
11 | use Slim\Http\Response; | 12 | use Slim\Http\Response; |
12 | 13 | ||
13 | class PutTagTest extends \PHPUnit_Framework_TestCase | 14 | class PutTagTest extends \PHPUnit\Framework\TestCase |
14 | { | 15 | { |
15 | /** | 16 | /** |
16 | * @var string datastore to test write operations | 17 | * @var string datastore to test write operations |
@@ -33,7 +34,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
33 | protected $refDB = null; | 34 | protected $refDB = null; |
34 | 35 | ||
35 | /** | 36 | /** |
36 | * @var \Shaarli\History instance. | 37 | * @var HistoryController instance. |
37 | */ | 38 | */ |
38 | protected $history; | 39 | protected $history; |
39 | 40 | ||
@@ -43,7 +44,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
43 | protected $container; | 44 | protected $container; |
44 | 45 | ||
45 | /** | 46 | /** |
46 | * @var \Shaarli\Bookmark\LinkDB instance. | 47 | * @var LinkDB instance. |
47 | */ | 48 | */ |
48 | protected $linkDB; | 49 | protected $linkDB; |
49 | 50 | ||
@@ -68,11 +69,11 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
68 | 69 | ||
69 | $refHistory = new \ReferenceHistory(); | 70 | $refHistory = new \ReferenceHistory(); |
70 | $refHistory->write(self::$testHistory); | 71 | $refHistory->write(self::$testHistory); |
71 | $this->history = new \Shaarli\History(self::$testHistory); | 72 | $this->history = new History(self::$testHistory); |
72 | 73 | ||
73 | $this->container = new Container(); | 74 | $this->container = new Container(); |
74 | $this->container['conf'] = $this->conf; | 75 | $this->container['conf'] = $this->conf; |
75 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 76 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
76 | $this->container['db'] = $this->linkDB; | 77 | $this->container['db'] = $this->linkDB; |
77 | $this->container['history'] = $this->history; | 78 | $this->container['history'] = $this->history; |
78 | 79 | ||
@@ -113,12 +114,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
113 | $this->assertEquals(2, $tags[$newName]); | 114 | $this->assertEquals(2, $tags[$newName]); |
114 | 115 | ||
115 | $historyEntry = $this->history->getHistory()[0]; | 116 | $historyEntry = $this->history->getHistory()[0]; |
116 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 117 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
117 | $this->assertTrue( | 118 | $this->assertTrue( |
118 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 119 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
119 | ); | 120 | ); |
120 | $historyEntry = $this->history->getHistory()[1]; | 121 | $historyEntry = $this->history->getHistory()[1]; |
121 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 122 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
122 | $this->assertTrue( | 123 | $this->assertTrue( |
123 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 124 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
124 | ); | 125 | ); |
diff --git a/tests/bookmark/LinkDBTest.php b/tests/bookmark/LinkDBTest.php index 65409e95..ff5c0b97 100644 --- a/tests/bookmark/LinkDBTest.php +++ b/tests/bookmark/LinkDBTest.php | |||
@@ -6,7 +6,6 @@ | |||
6 | namespace Shaarli\Bookmark; | 6 | namespace Shaarli\Bookmark; |
7 | 7 | ||
8 | use DateTime; | 8 | use DateTime; |
9 | use Shaarli\Bookmark\Exception\LinkNotFoundException; | ||
10 | use ReferenceLinkDB; | 9 | use ReferenceLinkDB; |
11 | use ReflectionClass; | 10 | use ReflectionClass; |
12 | use Shaarli; | 11 | use Shaarli; |
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php index 99c1ea56..95ad060b 100644 --- a/tests/config/ConfigJsonTest.php +++ b/tests/config/ConfigJsonTest.php | |||
@@ -4,7 +4,7 @@ namespace Shaarli\Config; | |||
4 | /** | 4 | /** |
5 | * Class ConfigJsonTest | 5 | * Class ConfigJsonTest |
6 | */ | 6 | */ |
7 | class ConfigJsonTest extends \PHPUnit_Framework_TestCase | 7 | class ConfigJsonTest extends \PHPUnit\Framework\TestCase |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * @var ConfigJson | 10 | * @var ConfigJson |
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 4a4e94ac..33830bc9 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php | |||
@@ -7,7 +7,7 @@ namespace Shaarli\Config; | |||
7 | * Note: it only test the manager with ConfigJson, | 7 | * Note: it only test the manager with ConfigJson, |
8 | * ConfigPhp is only a workaround to handle the transition to JSON type. | 8 | * ConfigPhp is only a workaround to handle the transition to JSON type. |
9 | */ | 9 | */ |
10 | class ConfigManagerTest extends \PHPUnit_Framework_TestCase | 10 | class ConfigManagerTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @var ConfigManager | 13 | * @var ConfigManager |
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php index be23eea1..67d878ce 100644 --- a/tests/config/ConfigPhpTest.php +++ b/tests/config/ConfigPhpTest.php | |||
@@ -4,7 +4,7 @@ namespace Shaarli\Config; | |||
4 | /** | 4 | /** |
5 | * Class ConfigPhpTest | 5 | * Class ConfigPhpTest |
6 | */ | 6 | */ |
7 | class ConfigPhpTest extends \PHPUnit_Framework_TestCase | 7 | class ConfigPhpTest extends \PHPUnit\Framework\TestCase |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * @var ConfigPhp | 10 | * @var ConfigPhp |
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index deb02c9e..d7a70e68 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php | |||
@@ -8,7 +8,7 @@ require_once 'application/config/ConfigPlugin.php'; | |||
8 | /** | 8 | /** |
9 | * Unitary tests for Shaarli config related functions | 9 | * Unitary tests for Shaarli config related functions |
10 | */ | 10 | */ |
11 | class ConfigPluginTest extends \PHPUnit_Framework_TestCase | 11 | class ConfigPluginTest extends \PHPUnit\Framework\TestCase |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | * Test save_plugin_config with valid data. | 14 | * Test save_plugin_config with valid data. |
diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php index 88d1c3ed..b496cb4c 100644 --- a/tests/feed/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php | |||
@@ -3,8 +3,8 @@ | |||
3 | namespace Shaarli\Feed; | 3 | namespace Shaarli\Feed; |
4 | 4 | ||
5 | use DateTime; | 5 | use DateTime; |
6 | use Shaarli\Bookmark\LinkDB; | ||
7 | use ReferenceLinkDB; | 6 | use ReferenceLinkDB; |
7 | use Shaarli\Bookmark\LinkDB; | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * FeedBuilderTest class. | 10 | * FeedBuilderTest class. |
diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index 38347de1..b8b7ca3a 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php | |||
@@ -12,7 +12,7 @@ use Shaarli\Config\ConfigManager; | |||
12 | * | 12 | * |
13 | * @package Shaarli | 13 | * @package Shaarli |
14 | */ | 14 | */ |
15 | class LanguagesFrTest extends \PHPUnit_Framework_TestCase | 15 | class LanguagesFrTest extends \PHPUnit\Framework\TestCase |
16 | { | 16 | { |
17 | /** | 17 | /** |
18 | * @var string Config file path (without extension). | 18 | * @var string Config file path (without extension). |
diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php index bcc01604..a3cd9076 100644 --- a/tests/plugins/WallabagInstanceTest.php +++ b/tests/plugins/WallabagInstanceTest.php | |||
@@ -1,8 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Plugin\Wallabag; | 2 | namespace Shaarli\Plugin\Wallabag; |
3 | 3 | ||
4 | use Shaarli\Plugin\Wallabag\WallabagInstance; | ||
5 | |||
6 | /** | 4 | /** |
7 | * Class WallabagInstanceTest | 5 | * Class WallabagInstanceTest |
8 | */ | 6 | */ |
diff --git a/tests/render/ThemeUtilsTest.php b/tests/render/ThemeUtilsTest.php index 6159a1bd..58e3426b 100644 --- a/tests/render/ThemeUtilsTest.php +++ b/tests/render/ThemeUtilsTest.php | |||
@@ -7,7 +7,7 @@ namespace Shaarli\Render; | |||
7 | * | 7 | * |
8 | * @package Shaarli | 8 | * @package Shaarli |
9 | */ | 9 | */ |
10 | class ThemeUtilsTest extends \PHPUnit_Framework_TestCase | 10 | class ThemeUtilsTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * Test getThemes() with existing theme directories. | 13 | * Test getThemes() with existing theme directories. |
diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php index f26cd1eb..de8055ed 100644 --- a/tests/security/LoginManagerTest.php +++ b/tests/security/LoginManagerTest.php | |||
@@ -2,7 +2,8 @@ | |||
2 | namespace Shaarli\Security; | 2 | namespace Shaarli\Security; |
3 | 3 | ||
4 | require_once 'tests/utils/FakeConfigManager.php'; | 4 | require_once 'tests/utils/FakeConfigManager.php'; |
5 | use \PHPUnit\Framework\TestCase; | 5 | |
6 | use PHPUnit\Framework\TestCase; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * Test coverage for LoginManager | 9 | * Test coverage for LoginManager |
diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index 7961e771..f264505e 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php | |||
@@ -5,8 +5,8 @@ require_once 'tests/utils/FakeConfigManager.php'; | |||
5 | require_once 'tests/utils/ReferenceSessionIdHashes.php'; | 5 | require_once 'tests/utils/ReferenceSessionIdHashes.php'; |
6 | ReferenceSessionIdHashes::genAllHashes(); | 6 | ReferenceSessionIdHashes::genAllHashes(); |
7 | 7 | ||
8 | use \Shaarli\Security\SessionManager; | 8 | use PHPUnit\Framework\TestCase; |
9 | use \PHPUnit\Framework\TestCase; | 9 | use Shaarli\Security\SessionManager; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Test coverage for SessionManager | 12 | * Test coverage for SessionManager |