aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ApplicationUtilsTest.php2
-rw-r--r--tests/FileUtilsTest.php2
-rw-r--r--tests/HistoryTest.php3
-rw-r--r--tests/LanguagesTest.php2
-rw-r--r--tests/PluginManagerTest.php2
-rw-r--r--tests/TestCase.php77
-rw-r--r--tests/ThumbnailerTest.php1
-rw-r--r--tests/TimeZoneTest.php2
-rw-r--r--tests/UtilsTest.php2
-rw-r--r--tests/api/ApiMiddlewareTest.php14
-rw-r--r--tests/api/ApiUtilsTest.php2
-rw-r--r--tests/api/controllers/history/HistoryTest.php2
-rw-r--r--tests/api/controllers/info/InfoTest.php2
-rw-r--r--tests/api/controllers/links/DeleteLinkTest.php2
-rw-r--r--tests/api/controllers/links/GetLinkIdTest.php2
-rw-r--r--tests/api/controllers/links/GetLinksTest.php2
-rw-r--r--tests/api/controllers/links/PostLinkTest.php2
-rw-r--r--tests/api/controllers/links/PutLinkTest.php2
-rw-r--r--tests/api/controllers/tags/DeleteTagTest.php2
-rw-r--r--tests/api/controllers/tags/GetTagNameTest.php2
-rw-r--r--tests/api/controllers/tags/GetTagsTest.php2
-rw-r--r--tests/api/controllers/tags/PutTagTest.php2
-rw-r--r--tests/bookmark/BookmarkArrayTest.php5
-rw-r--r--tests/bookmark/BookmarkFileServiceTest.php4
-rw-r--r--tests/bookmark/BookmarkFilterTest.php2
-rw-r--r--tests/bookmark/BookmarkInitializerTest.php2
-rw-r--r--tests/bookmark/BookmarkTest.php12
-rw-r--r--tests/bookmark/LinkUtilsTest.php22
-rw-r--r--tests/bootstrap.php1
-rw-r--r--tests/config/ConfigJsonTest.php2
-rw-r--r--tests/config/ConfigManagerTest.php2
-rw-r--r--tests/config/ConfigPhpTest.php2
-rw-r--r--tests/config/ConfigPluginTest.php2
-rw-r--r--tests/container/ContainerBuilderTest.php2
-rw-r--r--tests/feed/CachedPageTest.php2
-rw-r--r--tests/feed/FeedBuilderTest.php18
-rw-r--r--tests/formatter/BookmarkDefaultFormatterTest.php2
-rw-r--r--tests/formatter/BookmarkMarkdownFormatterTest.php2
-rw-r--r--tests/formatter/BookmarkRawFormatterTest.php2
-rw-r--r--tests/formatter/FormatterFactoryTest.php2
-rw-r--r--tests/front/ShaarliAdminMiddlewareTest.php2
-rw-r--r--tests/front/ShaarliMiddlewareTest.php2
-rw-r--r--tests/front/controller/admin/ConfigureControllerTest.php2
-rw-r--r--tests/front/controller/admin/ExportControllerTest.php2
-rw-r--r--tests/front/controller/admin/ImportControllerTest.php2
-rw-r--r--tests/front/controller/admin/LogoutControllerTest.php3
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php2
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php2
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php2
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php12
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php2
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php2
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php40
-rw-r--r--tests/front/controller/admin/ManageTagControllerTest.php2
-rw-r--r--tests/front/controller/admin/PasswordControllerTest.php2
-rw-r--r--tests/front/controller/admin/PluginsControllerTest.php2
-rw-r--r--tests/front/controller/admin/SessionFilterControllerTest.php2
-rw-r--r--tests/front/controller/admin/ShaarliAdminControllerTest.php2
-rw-r--r--tests/front/controller/admin/ThumbnailsControllerTest.php2
-rw-r--r--tests/front/controller/admin/TokenControllerTest.php2
-rw-r--r--tests/front/controller/admin/ToolsControllerTest.php2
-rw-r--r--tests/front/controller/visitor/BookmarkListControllerTest.php2
-rw-r--r--tests/front/controller/visitor/DailyControllerTest.php48
-rw-r--r--tests/front/controller/visitor/ErrorControllerTest.php2
-rw-r--r--tests/front/controller/visitor/ErrorNotFoundControllerTest.php2
-rw-r--r--tests/front/controller/visitor/FeedControllerTest.php38
-rw-r--r--tests/front/controller/visitor/FrontControllerMockHelper.php3
-rw-r--r--tests/front/controller/visitor/InstallControllerTest.php2
-rw-r--r--tests/front/controller/visitor/LoginControllerTest.php2
-rw-r--r--tests/front/controller/visitor/OpenSearchControllerTest.php2
-rw-r--r--tests/front/controller/visitor/PictureWallControllerTest.php18
-rw-r--r--tests/front/controller/visitor/PublicSessionFilterControllerTest.php2
-rw-r--r--tests/front/controller/visitor/ShaarliVisitorControllerTest.php2
-rw-r--r--tests/front/controller/visitor/TagCloudControllerTest.php74
-rw-r--r--tests/front/controller/visitor/TagControllerTest.php2
-rw-r--r--tests/http/HttpUtils/ClientIpIdTest.php2
-rw-r--r--tests/http/HttpUtils/GetHttpUrlTest.php2
-rw-r--r--tests/http/HttpUtils/GetIpAdressFromProxyTest.php2
-rw-r--r--tests/http/HttpUtils/IndexUrlTest.php2
-rw-r--r--tests/http/HttpUtils/IndexUrlTestWithConstant.php2
-rw-r--r--tests/http/HttpUtils/IsHttpsTest.php2
-rw-r--r--tests/http/HttpUtils/PageUrlTest.php2
-rw-r--r--tests/http/HttpUtils/ServerUrlTest.php2
-rw-r--r--tests/http/UrlTest.php2
-rw-r--r--tests/http/UrlUtils/CleanupUrlTest.php2
-rw-r--r--tests/http/UrlUtils/GetUrlSchemeTest.php2
-rw-r--r--tests/http/UrlUtils/UnparseUrlTest.php2
-rw-r--r--tests/http/UrlUtils/WhitelistProtocolsTest.php2
-rw-r--r--tests/languages/fr/LanguagesFrTest.php2
-rw-r--r--tests/legacy/LegacyControllerTest.php2
-rw-r--r--tests/legacy/LegacyLinkDBTest.php12
-rw-r--r--tests/legacy/LegacyLinkFilterTest.php2
-rw-r--r--tests/legacy/LegacyUpdaterTest.php4
-rw-r--r--tests/netscape/BookmarkExportTest.php2
-rw-r--r--tests/netscape/BookmarkImportTest.php2
-rw-r--r--tests/plugins/PluginAddlinkTest.php2
-rw-r--r--tests/plugins/PluginArchiveorgTest.php2
-rw-r--r--tests/plugins/PluginDefaultColorsTest.php2
-rw-r--r--tests/plugins/PluginIssoTest.php8
-rw-r--r--tests/plugins/PluginPlayvideosTest.php2
-rw-r--r--tests/plugins/PluginPubsubhubbubTest.php2
-rw-r--r--tests/plugins/PluginQrcodeTest.php2
-rw-r--r--tests/plugins/PluginWallabagTest.php2
-rw-r--r--tests/plugins/WallabagInstanceTest.php2
-rw-r--r--tests/render/PageCacheManagerTest.php2
-rw-r--r--tests/render/ThemeUtilsTest.php2
-rw-r--r--tests/security/BanManagerTest.php2
-rw-r--r--tests/security/LoginManagerTest.php2
-rw-r--r--tests/security/SessionManagerTest.php2
-rw-r--r--tests/updater/UpdaterTest.php2
110 files changed, 346 insertions, 249 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php
index 421d2dd9..7ad1d34c 100644
--- a/tests/ApplicationUtilsTest.php
+++ b/tests/ApplicationUtilsTest.php
@@ -8,7 +8,7 @@ require_once 'tests/utils/FakeApplicationUtils.php';
8/** 8/**
9 * Unitary tests for Shaarli utilities 9 * Unitary tests for Shaarli utilities
10 */ 10 */
11class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase 11class ApplicationUtilsTest extends \Shaarli\TestCase
12{ 12{
13 protected static $testUpdateFile = 'sandbox/update.txt'; 13 protected static $testUpdateFile = 'sandbox/update.txt';
14 protected static $testVersion = '0.5.0'; 14 protected static $testVersion = '0.5.0';
diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php
index 6e8f44f2..9163bdf1 100644
--- a/tests/FileUtilsTest.php
+++ b/tests/FileUtilsTest.php
@@ -9,7 +9,7 @@ use Exception;
9 * 9 *
10 * Test file utility class. 10 * Test file utility class.
11 */ 11 */
12class FileUtilsTest extends \PHPUnit\Framework\TestCase 12class FileUtilsTest extends \Shaarli\TestCase
13{ 13{
14 /** 14 /**
15 * @var string Test file path. 15 * @var string Test file path.
diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php
index fb633e79..6dc0e5b7 100644
--- a/tests/HistoryTest.php
+++ b/tests/HistoryTest.php
@@ -3,10 +3,9 @@
3namespace Shaarli; 3namespace Shaarli;
4 4
5use DateTime; 5use DateTime;
6use Exception;
7use Shaarli\Bookmark\Bookmark; 6use Shaarli\Bookmark\Bookmark;
8 7
9class HistoryTest extends \PHPUnit\Framework\TestCase 8class HistoryTest extends \Shaarli\TestCase
10{ 9{
11 /** 10 /**
12 * @var string History file path 11 * @var string History file path
diff --git a/tests/LanguagesTest.php b/tests/LanguagesTest.php
index 914179c8..ce24c160 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 */
10class LanguagesTest extends \PHPUnit\Framework\TestCase 10class LanguagesTest extends \Shaarli\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/PluginManagerTest.php b/tests/PluginManagerTest.php
index 3018999c..38cd5eba 100644
--- a/tests/PluginManagerTest.php
+++ b/tests/PluginManagerTest.php
@@ -6,7 +6,7 @@ use Shaarli\Config\ConfigManager;
6/** 6/**
7 * Unit tests for Plugins 7 * Unit tests for Plugins
8 */ 8 */
9class PluginManagerTest extends \PHPUnit\Framework\TestCase 9class PluginManagerTest extends \Shaarli\TestCase
10{ 10{
11 /** 11 /**
12 * Path to tests plugin. 12 * Path to tests plugin.
diff --git a/tests/TestCase.php b/tests/TestCase.php
new file mode 100644
index 00000000..781e7aa3
--- /dev/null
+++ b/tests/TestCase.php
@@ -0,0 +1,77 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Shaarli;
6
7/**
8 * Helper class extending \PHPUnit\Framework\TestCase.
9 * Used to make Shaarli UT run on multiple versions of PHPUnit.
10 */
11class TestCase extends \PHPUnit\Framework\TestCase
12{
13 /**
14 * expectExceptionMessageRegExp has been removed and replaced by expectExceptionMessageMatches in PHPUnit 9.
15 */
16 public function expectExceptionMessageRegExp(string $regularExpression): void
17 {
18 if (method_exists($this, 'expectExceptionMessageMatches')) {
19 $this->expectExceptionMessageMatches($regularExpression);
20 } else {
21 parent::expectExceptionMessageRegExp($regularExpression);
22 }
23 }
24
25 /**
26 * assertContains is now used for iterable, strings should use assertStringContainsString
27 */
28 public function assertContainsPolyfill($expected, $actual, string $message = ''): void
29 {
30 if (is_string($actual) && method_exists($this, 'assertStringContainsString')) {
31 static::assertStringContainsString($expected, $actual, $message);
32 } else {
33 static::assertContains($expected, $actual, $message);
34 }
35 }
36
37 /**
38 * assertNotContains is now used for iterable, strings should use assertStringNotContainsString
39 */
40 public function assertNotContainsPolyfill($expected, $actual, string $message = ''): void
41 {
42 if (is_string($actual) && method_exists($this, 'assertStringNotContainsString')) {
43 static::assertStringNotContainsString($expected, $actual, $message);
44 } else {
45 static::assertNotContains($expected, $actual, $message);
46 }
47 }
48
49 /**
50 * assertFileNotExists has been renamed in assertFileDoesNotExist
51 */
52 public static function assertFileNotExists(string $filename, string $message = ''): void
53 {
54 if (method_exists(TestCase::class, 'assertFileDoesNotExist')) {
55 static::assertFileDoesNotExist($filename, $message);
56 } else {
57 parent::assertFileNotExists($filename, $message);
58 }
59 }
60
61 /**
62 * assertRegExp has been renamed in assertMatchesRegularExpression
63 */
64 public static function assertRegExp(string $pattern, string $string, string $message = ''): void
65 {
66 if (method_exists(TestCase::class, 'assertMatchesRegularExpression')) {
67 static::assertMatchesRegularExpression($pattern, $string, $message);
68 } else {
69 parent::assertRegExp($pattern, $string, $message);
70 }
71 }
72
73 public function isInTestsContext(): bool
74 {
75 return true;
76 }
77}
diff --git a/tests/ThumbnailerTest.php b/tests/ThumbnailerTest.php
index 5b6d6a4d..70519aca 100644
--- a/tests/ThumbnailerTest.php
+++ b/tests/ThumbnailerTest.php
@@ -2,7 +2,6 @@
2 2
3namespace Shaarli; 3namespace Shaarli;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
7use WebThumbnailer\Application\ConfigManager as WTConfigManager; 6use WebThumbnailer\Application\ConfigManager as WTConfigManager;
8 7
diff --git a/tests/TimeZoneTest.php b/tests/TimeZoneTest.php
index d3d9aeeb..77862855 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 */
11class TimeZoneTest extends PHPUnit\Framework\TestCase 11class TimeZoneTest extends \Shaarli\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 93b77539..6e787d7f 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 */
13class UtilsTest extends PHPUnit\Framework\TestCase 13class UtilsTest extends \Shaarli\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 b157e4a7..7386e435 100644
--- a/tests/api/ApiMiddlewareTest.php
+++ b/tests/api/ApiMiddlewareTest.php
@@ -18,7 +18,7 @@ use Slim\Http\Response;
18 * 18 *
19 * @package Api 19 * @package Api
20 */ 20 */
21class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase 21class ApiMiddlewareTest extends \Shaarli\TestCase
22{ 22{
23 /** 23 /**
24 * @var string datastore to test write operations 24 * @var string datastore to test write operations
@@ -26,7 +26,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
26 protected static $testDatastore = 'sandbox/datastore.php'; 26 protected static $testDatastore = 'sandbox/datastore.php';
27 27
28 /** 28 /**
29 * @var \ConfigManager instance 29 * @var ConfigManager instance
30 */ 30 */
31 protected $conf; 31 protected $conf;
32 32
@@ -109,7 +109,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
109 $this->assertEquals(401, $response->getStatusCode()); 109 $this->assertEquals(401, $response->getStatusCode());
110 $body = json_decode((string) $response->getBody()); 110 $body = json_decode((string) $response->getBody());
111 $this->assertEquals('Not authorized: API is disabled', $body->message); 111 $this->assertEquals('Not authorized: API is disabled', $body->message);
112 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 112 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
113 } 113 }
114 114
115 /** 115 /**
@@ -132,7 +132,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
132 $this->assertEquals(401, $response->getStatusCode()); 132 $this->assertEquals(401, $response->getStatusCode());
133 $body = json_decode((string) $response->getBody()); 133 $body = json_decode((string) $response->getBody());
134 $this->assertEquals('Not authorized: JWT token not provided', $body->message); 134 $this->assertEquals('Not authorized: JWT token not provided', $body->message);
135 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 135 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
136 } 136 }
137 137
138 /** 138 /**
@@ -157,7 +157,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
157 $this->assertEquals(401, $response->getStatusCode()); 157 $this->assertEquals(401, $response->getStatusCode());
158 $body = json_decode((string) $response->getBody()); 158 $body = json_decode((string) $response->getBody());
159 $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message); 159 $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message);
160 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 160 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
161 } 161 }
162 162
163 /** 163 /**
@@ -180,7 +180,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
180 $this->assertEquals(401, $response->getStatusCode()); 180 $this->assertEquals(401, $response->getStatusCode());
181 $body = json_decode((string) $response->getBody()); 181 $body = json_decode((string) $response->getBody());
182 $this->assertEquals('Not authorized: Invalid JWT header', $body->message); 182 $this->assertEquals('Not authorized: Invalid JWT header', $body->message);
183 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 183 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
184 } 184 }
185 185
186 /** 186 /**
@@ -206,6 +206,6 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
206 $this->assertEquals(401, $response->getStatusCode()); 206 $this->assertEquals(401, $response->getStatusCode());
207 $body = json_decode((string) $response->getBody()); 207 $body = json_decode((string) $response->getBody());
208 $this->assertEquals('Not authorized: Malformed JWT token', $body->message); 208 $this->assertEquals('Not authorized: Malformed JWT token', $body->message);
209 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 209 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
210 } 210 }
211} 211}
diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php
index 96787014..7a143859 100644
--- a/tests/api/ApiUtilsTest.php
+++ b/tests/api/ApiUtilsTest.php
@@ -8,7 +8,7 @@ use Shaarli\Http\Base64Url;
8/** 8/**
9 * Class ApiUtilsTest 9 * Class ApiUtilsTest
10 */ 10 */
11class ApiUtilsTest extends \PHPUnit\Framework\TestCase 11class ApiUtilsTest extends \Shaarli\TestCase
12{ 12{
13 /** 13 /**
14 * Force the timezone for ISO datetimes. 14 * Force the timezone for ISO datetimes.
diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php
index 40f26b12..84f8716e 100644
--- a/tests/api/controllers/history/HistoryTest.php
+++ b/tests/api/controllers/history/HistoryTest.php
@@ -11,7 +11,7 @@ use Slim\Http\Response;
11 11
12require_once 'tests/utils/ReferenceHistory.php'; 12require_once 'tests/utils/ReferenceHistory.php';
13 13
14class HistoryTest extends \PHPUnit\Framework\TestCase 14class HistoryTest extends \Shaarli\TestCase
15{ 15{
16 /** 16 /**
17 * @var string datastore to test write operations 17 * @var string datastore to test write operations
diff --git a/tests/api/controllers/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php
index cc50d2e3..1598e1e8 100644
--- a/tests/api/controllers/info/InfoTest.php
+++ b/tests/api/controllers/info/InfoTest.php
@@ -1,10 +1,10 @@
1<?php 1<?php
2namespace Shaarli\Api\Controllers; 2namespace Shaarli\Api\Controllers;
3 3
4use PHPUnit\Framework\TestCase;
5use Shaarli\Bookmark\BookmarkFileService; 4use Shaarli\Bookmark\BookmarkFileService;
6use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
7use Shaarli\History; 6use Shaarli\History;
7use Shaarli\TestCase;
8use Slim\Container; 8use Slim\Container;
9use Slim\Http\Environment; 9use Slim\Http\Environment;
10use Slim\Http\Request; 10use Slim\Http\Request;
diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php
index bd8403cf..cf9464f0 100644
--- a/tests/api/controllers/links/DeleteLinkTest.php
+++ b/tests/api/controllers/links/DeleteLinkTest.php
@@ -11,7 +11,7 @@ use Slim\Http\Environment;
11use Slim\Http\Request; 11use Slim\Http\Request;
12use Slim\Http\Response; 12use Slim\Http\Response;
13 13
14class DeleteLinkTest extends \PHPUnit\Framework\TestCase 14class DeleteLinkTest extends \Shaarli\TestCase
15{ 15{
16 /** 16 /**
17 * @var string datastore to test write operations 17 * @var string datastore to test write operations
diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php
index 3a3aaa7b..99dc606f 100644
--- a/tests/api/controllers/links/GetLinkIdTest.php
+++ b/tests/api/controllers/links/GetLinkIdTest.php
@@ -20,7 +20,7 @@ use Slim\Http\Response;
20 * 20 *
21 * @package Shaarli\Api\Controllers 21 * @package Shaarli\Api\Controllers
22 */ 22 */
23class GetLinkIdTest extends \PHPUnit\Framework\TestCase 23class GetLinkIdTest extends \Shaarli\TestCase
24{ 24{
25 /** 25 /**
26 * @var string datastore to test write operations 26 * @var string datastore to test write operations
diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php
index 01c40c2f..ca1bfc63 100644
--- a/tests/api/controllers/links/GetLinksTest.php
+++ b/tests/api/controllers/links/GetLinksTest.php
@@ -20,7 +20,7 @@ use Slim\Http\Response;
20 * 20 *
21 * @package Shaarli\Api\Controllers 21 * @package Shaarli\Api\Controllers
22 */ 22 */
23class GetLinksTest extends \PHPUnit\Framework\TestCase 23class GetLinksTest extends \Shaarli\TestCase
24{ 24{
25 /** 25 /**
26 * @var string datastore to test write operations 26 * @var string datastore to test write operations
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php
index b1c9008b..fe3de66f 100644
--- a/tests/api/controllers/links/PostLinkTest.php
+++ b/tests/api/controllers/links/PostLinkTest.php
@@ -2,11 +2,11 @@
2 2
3namespace Shaarli\Api\Controllers; 3namespace Shaarli\Api\Controllers;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\Bookmark; 5use Shaarli\Bookmark\Bookmark;
7use Shaarli\Bookmark\BookmarkFileService; 6use Shaarli\Bookmark\BookmarkFileService;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\History; 8use Shaarli\History;
9use Shaarli\TestCase;
10use Slim\Container; 10use Slim\Container;
11use Slim\Http\Environment; 11use Slim\Http\Environment;
12use Slim\Http\Request; 12use Slim\Http\Request;
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php
index 3d62a1b1..a2e87c59 100644
--- a/tests/api/controllers/links/PutLinkTest.php
+++ b/tests/api/controllers/links/PutLinkTest.php
@@ -12,7 +12,7 @@ use Slim\Http\Environment;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
15class PutLinkTest extends \PHPUnit\Framework\TestCase 15class PutLinkTest extends \Shaarli\TestCase
16{ 16{
17 /** 17 /**
18 * @var string datastore to test write operations 18 * @var string datastore to test write operations
diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php
index 0d991b85..1326eb47 100644
--- a/tests/api/controllers/tags/DeleteTagTest.php
+++ b/tests/api/controllers/tags/DeleteTagTest.php
@@ -12,7 +12,7 @@ use Slim\Http\Environment;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
15class DeleteTagTest extends \PHPUnit\Framework\TestCase 15class DeleteTagTest extends \Shaarli\TestCase
16{ 16{
17 /** 17 /**
18 * @var string datastore to test write operations 18 * @var string datastore to test write operations
diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php
index a2fb89ab..9c05954b 100644
--- a/tests/api/controllers/tags/GetTagNameTest.php
+++ b/tests/api/controllers/tags/GetTagNameTest.php
@@ -18,7 +18,7 @@ use Slim\Http\Response;
18 * 18 *
19 * @package Shaarli\Api\Controllers 19 * @package Shaarli\Api\Controllers
20 */ 20 */
21class GetTagNameTest extends \PHPUnit\Framework\TestCase 21class GetTagNameTest extends \Shaarli\TestCase
22{ 22{
23 /** 23 /**
24 * @var string datastore to test write operations 24 * @var string datastore to test write operations
diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php
index ab666f20..3459fdfa 100644
--- a/tests/api/controllers/tags/GetTagsTest.php
+++ b/tests/api/controllers/tags/GetTagsTest.php
@@ -17,7 +17,7 @@ use Slim\Http\Response;
17 * 17 *
18 * @package Shaarli\Api\Controllers 18 * @package Shaarli\Api\Controllers
19 */ 19 */
20class GetTagsTest extends \PHPUnit\Framework\TestCase 20class GetTagsTest extends \Shaarli\TestCase
21{ 21{
22 /** 22 /**
23 * @var string datastore to test write operations 23 * @var string datastore to test write operations
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php
index 0845dce1..74edde78 100644
--- a/tests/api/controllers/tags/PutTagTest.php
+++ b/tests/api/controllers/tags/PutTagTest.php
@@ -12,7 +12,7 @@ use Slim\Http\Environment;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
15class PutTagTest extends \PHPUnit\Framework\TestCase 15class PutTagTest extends \Shaarli\TestCase
16{ 16{
17 /** 17 /**
18 * @var string datastore to test write operations 18 * @var string datastore to test write operations
diff --git a/tests/bookmark/BookmarkArrayTest.php b/tests/bookmark/BookmarkArrayTest.php
index bad3af8d..ebed9bfc 100644
--- a/tests/bookmark/BookmarkArrayTest.php
+++ b/tests/bookmark/BookmarkArrayTest.php
@@ -2,10 +2,7 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6use Shaarli\Bookmark\Exception\InvalidBookmarkException;
7use Shaarli\Config\ConfigManager;
8use Shaarli\History;
9 6
10/** 7/**
11 * Class BookmarkArrayTest 8 * Class BookmarkArrayTest
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index 9cff0fb3..51e71a85 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -6,7 +6,6 @@
6namespace Shaarli\Bookmark; 6namespace Shaarli\Bookmark;
7 7
8use DateTime; 8use DateTime;
9use PHPUnit\Framework\TestCase;
10use ReferenceLinkDB; 9use ReferenceLinkDB;
11use ReflectionClass; 10use ReflectionClass;
12use Shaarli; 11use Shaarli;
@@ -14,6 +13,7 @@ use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
14use Shaarli\Config\ConfigManager; 13use Shaarli\Config\ConfigManager;
15use Shaarli\Formatter\BookmarkMarkdownFormatter; 14use Shaarli\Formatter\BookmarkMarkdownFormatter;
16use Shaarli\History; 15use Shaarli\History;
16use Shaarli\TestCase;
17 17
18/** 18/**
19 * Unitary tests for LegacyLinkDBTest 19 * Unitary tests for LegacyLinkDBTest
@@ -748,7 +748,7 @@ class BookmarkFileServiceTest extends TestCase
748 $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/'); 748 $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/');
749 749
750 $this->assertNotEquals(false, $link); 750 $this->assertNotEquals(false, $link);
751 $this->assertContains( 751 $this->assertContainsPolyfill(
752 'A free software media publishing platform', 752 'A free software media publishing platform',
753 $link->getDescription() 753 $link->getDescription()
754 ); 754 );
diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php
index 752631a5..2f15cb3c 100644
--- a/tests/bookmark/BookmarkFilterTest.php
+++ b/tests/bookmark/BookmarkFilterTest.php
@@ -3,10 +3,10 @@
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use Exception; 5use Exception;
6use PHPUnit\Framework\TestCase;
7use ReferenceLinkDB; 6use ReferenceLinkDB;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\History; 8use Shaarli\History;
9use Shaarli\TestCase;
10 10
11/** 11/**
12 * Class BookmarkFilterTest. 12 * Class BookmarkFilterTest.
diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php
index 454269bb..25704004 100644
--- a/tests/bookmark/BookmarkInitializerTest.php
+++ b/tests/bookmark/BookmarkInitializerTest.php
@@ -2,9 +2,9 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
7use Shaarli\History; 6use Shaarli\History;
7use Shaarli\TestCase;
8 8
9/** 9/**
10 * Class BookmarkInitializerTest 10 * Class BookmarkInitializerTest
diff --git a/tests/bookmark/BookmarkTest.php b/tests/bookmark/BookmarkTest.php
index 4b6a3c07..afec2440 100644
--- a/tests/bookmark/BookmarkTest.php
+++ b/tests/bookmark/BookmarkTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\Exception\InvalidBookmarkException; 5use Shaarli\Bookmark\Exception\InvalidBookmarkException;
6use Shaarli\TestCase;
7 7
8/** 8/**
9 * Class BookmarkTest 9 * Class BookmarkTest
@@ -150,7 +150,7 @@ class BookmarkTest extends TestCase
150 $exception = $e; 150 $exception = $e;
151 } 151 }
152 $this->assertNotNull($exception); 152 $this->assertNotNull($exception);
153 $this->assertContains('- ID: '. PHP_EOL, $exception->getMessage()); 153 $this->assertContainsPolyfill('- ID: '. PHP_EOL, $exception->getMessage());
154 } 154 }
155 155
156 /** 156 /**
@@ -169,7 +169,7 @@ class BookmarkTest extends TestCase
169 $exception = $e; 169 $exception = $e;
170 } 170 }
171 $this->assertNotNull($exception); 171 $this->assertNotNull($exception);
172 $this->assertContains('- ID: str'. PHP_EOL, $exception->getMessage()); 172 $this->assertContainsPolyfill('- ID: str'. PHP_EOL, $exception->getMessage());
173 } 173 }
174 174
175 /** 175 /**
@@ -188,7 +188,7 @@ class BookmarkTest extends TestCase
188 $exception = $e; 188 $exception = $e;
189 } 189 }
190 $this->assertNotNull($exception); 190 $this->assertNotNull($exception);
191 $this->assertContains('- ShortUrl: '. PHP_EOL, $exception->getMessage()); 191 $this->assertContainsPolyfill('- ShortUrl: '. PHP_EOL, $exception->getMessage());
192 } 192 }
193 193
194 /** 194 /**
@@ -207,7 +207,7 @@ class BookmarkTest extends TestCase
207 $exception = $e; 207 $exception = $e;
208 } 208 }
209 $this->assertNotNull($exception); 209 $this->assertNotNull($exception);
210 $this->assertContains('- Created: '. PHP_EOL, $exception->getMessage()); 210 $this->assertContainsPolyfill('- Created: '. PHP_EOL, $exception->getMessage());
211 } 211 }
212 212
213 /** 213 /**
@@ -226,7 +226,7 @@ class BookmarkTest extends TestCase
226 $exception = $e; 226 $exception = $e;
227 } 227 }
228 $this->assertNotNull($exception); 228 $this->assertNotNull($exception);
229 $this->assertContains('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); 229 $this->assertContainsPolyfill('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage());
230 } 230 }
231 231
232 /** 232 /**
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php
index 7d4a7b89..a7087953 100644
--- a/tests/bookmark/LinkUtilsTest.php
+++ b/tests/bookmark/LinkUtilsTest.php
@@ -2,7 +2,7 @@
2 2
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6 6
7require_once 'tests/utils/CurlUtils.php'; 7require_once 'tests/utils/CurlUtils.php';
8 8
@@ -437,13 +437,13 @@ class LinkUtilsTest extends TestCase
437 カタカナ #カタカナ」カタカナ\n'; 437 カタカナ #カタカナ」カタカナ\n';
438 $autolinkedDescription = hashtag_autolink($rawDescription, $index); 438 $autolinkedDescription = hashtag_autolink($rawDescription, $index);
439 439
440 $this->assertContains($this->getHashtagLink('hashtag', $index), $autolinkedDescription); 440 $this->assertContainsPolyfill($this->getHashtagLink('hashtag', $index), $autolinkedDescription);
441 $this->assertNotContains(' #hashtag', $autolinkedDescription); 441 $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
442 $this->assertNotContains('>#nothashtag', $autolinkedDescription); 442 $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
443 $this->assertContains($this->getHashtagLink('ашок', $index), $autolinkedDescription); 443 $this->assertContainsPolyfill($this->getHashtagLink('ашок', $index), $autolinkedDescription);
444 $this->assertContains($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); 444 $this->assertContainsPolyfill($this->getHashtagLink('カタカナ', $index), $autolinkedDescription);
445 $this->assertContains($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); 445 $this->assertContainsPolyfill($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription);
446 $this->assertNotContains($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); 446 $this->assertNotContainsPolyfill($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription);
447 } 447 }
448 448
449 /** 449 /**
@@ -454,9 +454,9 @@ class LinkUtilsTest extends TestCase
454 $rawDescription = 'blabla #hashtag x#nothashtag'; 454 $rawDescription = 'blabla #hashtag x#nothashtag';
455 $autolinkedDescription = hashtag_autolink($rawDescription); 455 $autolinkedDescription = hashtag_autolink($rawDescription);
456 456
457 $this->assertContains($this->getHashtagLink('hashtag'), $autolinkedDescription); 457 $this->assertContainsPolyfill($this->getHashtagLink('hashtag'), $autolinkedDescription);
458 $this->assertNotContains(' #hashtag', $autolinkedDescription); 458 $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription);
459 $this->assertNotContains('>#nothashtag', $autolinkedDescription); 459 $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription);
460 } 460 }
461 461
462 /** 462 /**
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index d4ddedd5..2d675c9a 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -18,6 +18,7 @@ require_once 'application/bookmark/LinkUtils.php';
18require_once 'application/Utils.php'; 18require_once 'application/Utils.php';
19require_once 'application/http/UrlUtils.php'; 19require_once 'application/http/UrlUtils.php';
20require_once 'application/http/HttpUtils.php'; 20require_once 'application/http/HttpUtils.php';
21require_once 'tests/TestCase.php';
21require_once 'tests/container/ShaarliTestContainer.php'; 22require_once 'tests/container/ShaarliTestContainer.php';
22require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php'; 23require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php';
23require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php'; 24require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php';
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php
index f884b0c6..4f508925 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 */
7class ConfigJsonTest extends \PHPUnit\Framework\TestCase 7class ConfigJsonTest extends \Shaarli\TestCase
8{ 8{
9 /** 9 /**
10 * @var ConfigJson 10 * @var ConfigJson
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php
index 802e6524..65d8ba2c 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 */
10class ConfigManagerTest extends \PHPUnit\Framework\TestCase 10class ConfigManagerTest extends \Shaarli\TestCase
11{ 11{
12 /** 12 /**
13 * @var ConfigManager 13 * @var ConfigManager
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php
index a9aa80f5..7bf9fe64 100644
--- a/tests/config/ConfigPhpTest.php
+++ b/tests/config/ConfigPhpTest.php
@@ -8,7 +8,7 @@ namespace Shaarli\Config;
8 * which are kept between tests. 8 * which are kept between tests.
9 * @runTestsInSeparateProcesses 9 * @runTestsInSeparateProcesses
10 */ 10 */
11class ConfigPhpTest extends \PHPUnit\Framework\TestCase 11class ConfigPhpTest extends \Shaarli\TestCase
12{ 12{
13 /** 13 /**
14 * @var ConfigPhp 14 * @var ConfigPhp
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php
index 3a45f623..fa72d8c4 100644
--- a/tests/config/ConfigPluginTest.php
+++ b/tests/config/ConfigPluginTest.php
@@ -9,7 +9,7 @@ require_once 'application/config/ConfigPlugin.php';
9/** 9/**
10 * Unitary tests for Shaarli config related functions 10 * Unitary tests for Shaarli config related functions
11 */ 11 */
12class ConfigPluginTest extends \PHPUnit\Framework\TestCase 12class ConfigPluginTest extends \Shaarli\TestCase
13{ 13{
14 /** 14 /**
15 * Test save_plugin_config with valid data. 15 * Test save_plugin_config with valid data.
diff --git a/tests/container/ContainerBuilderTest.php b/tests/container/ContainerBuilderTest.php
index 2047a63a..5d52daef 100644
--- a/tests/container/ContainerBuilderTest.php
+++ b/tests/container/ContainerBuilderTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Container; 5namespace Shaarli\Container;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkServiceInterface; 7use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Feed\FeedBuilder; 9use Shaarli\Feed\FeedBuilder;
@@ -20,6 +19,7 @@ use Shaarli\Render\PageCacheManager;
20use Shaarli\Security\CookieManager; 19use Shaarli\Security\CookieManager;
21use Shaarli\Security\LoginManager; 20use Shaarli\Security\LoginManager;
22use Shaarli\Security\SessionManager; 21use Shaarli\Security\SessionManager;
22use Shaarli\TestCase;
23use Shaarli\Thumbnailer; 23use Shaarli\Thumbnailer;
24use Shaarli\Updater\Updater; 24use Shaarli\Updater\Updater;
25use Slim\Http\Environment; 25use Slim\Http\Environment;
diff --git a/tests/feed/CachedPageTest.php b/tests/feed/CachedPageTest.php
index 25d640d3..904db9dc 100644
--- a/tests/feed/CachedPageTest.php
+++ b/tests/feed/CachedPageTest.php
@@ -7,7 +7,7 @@ namespace Shaarli\Feed;
7/** 7/**
8 * Unitary tests for cached pages 8 * Unitary tests for cached pages
9 */ 9 */
10class CachedPageTest extends \PHPUnit\Framework\TestCase 10class CachedPageTest extends \Shaarli\TestCase
11{ 11{
12 // test cache directory 12 // test cache directory
13 protected static $testCacheDir = 'sandbox/pagecache'; 13 protected static $testCacheDir = 'sandbox/pagecache';
diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php
index 5dfe73aa..c29e8ef3 100644
--- a/tests/feed/FeedBuilderTest.php
+++ b/tests/feed/FeedBuilderTest.php
@@ -3,7 +3,6 @@
3namespace Shaarli\Feed; 3namespace Shaarli\Feed;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use ReferenceLinkDB; 6use ReferenceLinkDB;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\BookmarkFileService; 8use Shaarli\Bookmark\BookmarkFileService;
@@ -11,6 +10,7 @@ use Shaarli\Bookmark\LinkDB;
11use Shaarli\Config\ConfigManager; 10use Shaarli\Config\ConfigManager;
12use Shaarli\Formatter\FormatterFactory; 11use Shaarli\Formatter\FormatterFactory;
13use Shaarli\History; 12use Shaarli\History;
13use Shaarli\TestCase;
14 14
15/** 15/**
16 * FeedBuilderTest class. 16 * FeedBuilderTest class.
@@ -97,9 +97,9 @@ class FeedBuilderTest extends TestCase
97 $pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']); 97 $pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']);
98 $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']); 98 $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']);
99 $this->assertEquals($pub, $up); 99 $this->assertEquals($pub, $up);
100 $this->assertContains('Stallman has a beard', $link['description']); 100 $this->assertContainsPolyfill('Stallman has a beard', $link['description']);
101 $this->assertContains('Permalink', $link['description']); 101 $this->assertContainsPolyfill('Permalink', $link['description']);
102 $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); 102 $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']);
103 $this->assertEquals(1, count($link['taglist'])); 103 $this->assertEquals(1, count($link['taglist']));
104 $this->assertEquals('sTuff', $link['taglist'][0]); 104 $this->assertEquals('sTuff', $link['taglist'][0]);
105 105
@@ -201,16 +201,16 @@ class FeedBuilderTest extends TestCase
201 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); 201 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
202 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']); 202 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
203 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']); 203 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']);
204 $this->assertContains('Direct link', $link['description']); 204 $this->assertContainsPolyfill('Direct link', $link['description']);
205 $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); 205 $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']);
206 // Second link is a direct link 206 // Second link is a direct link
207 $link = $data['links'][array_keys($data['links'])[1]]; 207 $link = $data['links'][array_keys($data['links'])[1]];
208 $this->assertEquals(8, $link['id']); 208 $this->assertEquals(8, $link['id']);
209 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); 209 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
210 $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']); 210 $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']);
211 $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); 211 $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']);
212 $this->assertContains('Direct link', $link['description']); 212 $this->assertContainsPolyfill('Direct link', $link['description']);
213 $this->assertContains('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']); 213 $this->assertContainsPolyfill('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']);
214 } 214 }
215 215
216 /** 216 /**
@@ -274,6 +274,6 @@ class FeedBuilderTest extends TestCase
274 $link = $data['links'][array_keys($data['links'])[0]]; 274 $link = $data['links'][array_keys($data['links'])[0]];
275 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']); 275 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']);
276 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']); 276 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']);
277 $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); 277 $this->assertContainsPolyfill('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']);
278 } 278 }
279} 279}
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php
index 9ea86c14..9534436e 100644
--- a/tests/formatter/BookmarkDefaultFormatterTest.php
+++ b/tests/formatter/BookmarkDefaultFormatterTest.php
@@ -3,9 +3,9 @@
3namespace Shaarli\Formatter; 3namespace Shaarli\Formatter;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use Shaarli\Bookmark\Bookmark; 6use Shaarli\Bookmark\Bookmark;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\TestCase;
9 9
10/** 10/**
11 * Class BookmarkDefaultFormatterTest 11 * Class BookmarkDefaultFormatterTest
diff --git a/tests/formatter/BookmarkMarkdownFormatterTest.php b/tests/formatter/BookmarkMarkdownFormatterTest.php
index a7729416..ab6b4080 100644
--- a/tests/formatter/BookmarkMarkdownFormatterTest.php
+++ b/tests/formatter/BookmarkMarkdownFormatterTest.php
@@ -3,9 +3,9 @@
3namespace Shaarli\Formatter; 3namespace Shaarli\Formatter;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use Shaarli\Bookmark\Bookmark; 6use Shaarli\Bookmark\Bookmark;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\TestCase;
9 9
10/** 10/**
11 * Class BookmarkMarkdownFormatterTest 11 * Class BookmarkMarkdownFormatterTest
diff --git a/tests/formatter/BookmarkRawFormatterTest.php b/tests/formatter/BookmarkRawFormatterTest.php
index 76cf1172..c76bb7b9 100644
--- a/tests/formatter/BookmarkRawFormatterTest.php
+++ b/tests/formatter/BookmarkRawFormatterTest.php
@@ -3,9 +3,9 @@
3namespace Shaarli\Formatter; 3namespace Shaarli\Formatter;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use Shaarli\Bookmark\Bookmark; 6use Shaarli\Bookmark\Bookmark;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\TestCase;
9 9
10/** 10/**
11 * Class BookmarkRawFormatterTest 11 * Class BookmarkRawFormatterTest
diff --git a/tests/formatter/FormatterFactoryTest.php b/tests/formatter/FormatterFactoryTest.php
index 6aab6a61..ae476cb5 100644
--- a/tests/formatter/FormatterFactoryTest.php
+++ b/tests/formatter/FormatterFactoryTest.php
@@ -2,8 +2,8 @@
2 2
3namespace Shaarli\Formatter; 3namespace Shaarli\Formatter;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Config\ConfigManager; 5use Shaarli\Config\ConfigManager;
6use Shaarli\TestCase;
7 7
8/** 8/**
9 * Class FormatterFactoryTest 9 * Class FormatterFactoryTest
diff --git a/tests/front/ShaarliAdminMiddlewareTest.php b/tests/front/ShaarliAdminMiddlewareTest.php
index 7451330b..44025f11 100644
--- a/tests/front/ShaarliAdminMiddlewareTest.php
+++ b/tests/front/ShaarliAdminMiddlewareTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front; 5namespace Shaarli\Front;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Container\ShaarliContainer; 8use Shaarli\Container\ShaarliContainer;
10use Shaarli\Security\LoginManager; 9use Shaarli\Security\LoginManager;
10use Shaarli\TestCase;
11use Shaarli\Updater\Updater; 11use Shaarli\Updater\Updater;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
diff --git a/tests/front/ShaarliMiddlewareTest.php b/tests/front/ShaarliMiddlewareTest.php
index 05aa34a9..655c5bba 100644
--- a/tests/front/ShaarliMiddlewareTest.php
+++ b/tests/front/ShaarliMiddlewareTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front; 5namespace Shaarli\Front;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Container\ShaarliContainer; 8use Shaarli\Container\ShaarliContainer;
10use Shaarli\Front\Exception\LoginBannedException; 9use Shaarli\Front\Exception\LoginBannedException;
@@ -12,6 +11,7 @@ use Shaarli\Front\Exception\UnauthorizedException;
12use Shaarli\Render\PageBuilder; 11use Shaarli\Render\PageBuilder;
13use Shaarli\Render\PageCacheManager; 12use Shaarli\Render\PageCacheManager;
14use Shaarli\Security\LoginManager; 13use Shaarli\Security\LoginManager;
14use Shaarli\TestCase;
15use Shaarli\Updater\Updater; 15use Shaarli\Updater\Updater;
16use Slim\Http\Request; 16use Slim\Http\Request;
17use Slim\Http\Response; 17use Slim\Http\Response;
diff --git a/tests/front/controller/admin/ConfigureControllerTest.php b/tests/front/controller/admin/ConfigureControllerTest.php
index 612f20f1..aca6cff3 100644
--- a/tests/front/controller/admin/ConfigureControllerTest.php
+++ b/tests/front/controller/admin/ConfigureControllerTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\WrongTokenException; 8use Shaarli\Front\Exception\WrongTokenException;
10use Shaarli\Security\SessionManager; 9use Shaarli\Security\SessionManager;
10use Shaarli\TestCase;
11use Shaarli\Thumbnailer; 11use Shaarli\Thumbnailer;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
diff --git a/tests/front/controller/admin/ExportControllerTest.php b/tests/front/controller/admin/ExportControllerTest.php
index 12d26f4a..0e6f2762 100644
--- a/tests/front/controller/admin/ExportControllerTest.php
+++ b/tests/front/controller/admin/ExportControllerTest.php
@@ -4,12 +4,12 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Formatter\BookmarkFormatter; 8use Shaarli\Formatter\BookmarkFormatter;
10use Shaarli\Formatter\BookmarkRawFormatter; 9use Shaarli\Formatter\BookmarkRawFormatter;
11use Shaarli\Netscape\NetscapeBookmarkUtils; 10use Shaarli\Netscape\NetscapeBookmarkUtils;
12use Shaarli\Security\SessionManager; 11use Shaarli\Security\SessionManager;
12use Shaarli\TestCase;
13use Slim\Http\Request; 13use Slim\Http\Request;
14use Slim\Http\Response; 14use Slim\Http\Response;
15 15
diff --git a/tests/front/controller/admin/ImportControllerTest.php b/tests/front/controller/admin/ImportControllerTest.php
index eb31fad0..c266caa5 100644
--- a/tests/front/controller/admin/ImportControllerTest.php
+++ b/tests/front/controller/admin/ImportControllerTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Psr\Http\Message\UploadedFileInterface; 7use Psr\Http\Message\UploadedFileInterface;
9use Shaarli\Netscape\NetscapeBookmarkUtils; 8use Shaarli\Netscape\NetscapeBookmarkUtils;
10use Shaarli\Security\SessionManager; 9use Shaarli\Security\SessionManager;
10use Shaarli\TestCase;
11use Slim\Http\Request; 11use Slim\Http\Request;
12use Slim\Http\Response; 12use Slim\Http\Response;
13use Slim\Http\UploadedFile; 13use Slim\Http\UploadedFile;
diff --git a/tests/front/controller/admin/LogoutControllerTest.php b/tests/front/controller/admin/LogoutControllerTest.php
index 45e84dc0..94e53019 100644
--- a/tests/front/controller/admin/LogoutControllerTest.php
+++ b/tests/front/controller/admin/LogoutControllerTest.php
@@ -4,10 +4,9 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Security\CookieManager; 7use Shaarli\Security\CookieManager;
9use Shaarli\Security\LoginManager;
10use Shaarli\Security\SessionManager; 8use Shaarli\Security\SessionManager;
9use Shaarli\TestCase;
11use Slim\Http\Request; 10use Slim\Http\Request;
12use Slim\Http\Response; 11use Slim\Http\Response;
13 12
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php b/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php
index 7d5b752a..0f27ec2f 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; 7use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
9use Shaarli\Front\Controller\Admin\ManageShaareController; 8use Shaarli\Front\Controller\Admin\ManageShaareController;
10use Shaarli\Http\HttpAccess; 9use Shaarli\Http\HttpAccess;
10use Shaarli\TestCase;
11use Slim\Http\Request; 11use Slim\Http\Request;
12use Slim\Http\Response; 12use Slim\Http\Response;
13 13
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php
index 5a615791..096d0774 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
10use Shaarli\Formatter\BookmarkFormatter; 9use Shaarli\Formatter\BookmarkFormatter;
@@ -14,6 +13,7 @@ use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
14use Shaarli\Front\Controller\Admin\ManageShaareController; 13use Shaarli\Front\Controller\Admin\ManageShaareController;
15use Shaarli\Http\HttpAccess; 14use Shaarli\Http\HttpAccess;
16use Shaarli\Security\SessionManager; 15use Shaarli\Security\SessionManager;
16use Shaarli\TestCase;
17use Slim\Http\Request; 17use Slim\Http\Request;
18use Slim\Http\Response; 18use Slim\Http\Response;
19 19
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php
index dee622bb..ba774e21 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
10use Shaarli\Formatter\BookmarkFormatter; 9use Shaarli\Formatter\BookmarkFormatter;
@@ -13,6 +12,7 @@ use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
13use Shaarli\Front\Controller\Admin\ManageShaareController; 12use Shaarli\Front\Controller\Admin\ManageShaareController;
14use Shaarli\Http\HttpAccess; 13use Shaarli\Http\HttpAccess;
15use Shaarli\Security\SessionManager; 14use Shaarli\Security\SessionManager;
15use Shaarli\TestCase;
16use Slim\Http\Request; 16use Slim\Http\Request;
17use Slim\Http\Response; 17use Slim\Http\Response;
18 18
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php
index 777583d5..2eb95251 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php
@@ -4,12 +4,12 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; 9use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
11use Shaarli\Front\Controller\Admin\ManageShaareController; 10use Shaarli\Front\Controller\Admin\ManageShaareController;
12use Shaarli\Http\HttpAccess; 11use Shaarli\Http\HttpAccess;
12use Shaarli\TestCase;
13use Slim\Http\Request; 13use Slim\Http\Request;
14use Slim\Http\Response; 14use Slim\Http\Response;
15 15
@@ -96,12 +96,14 @@ class DisplayCreateFormTest extends TestCase
96 96
97 // Make sure that PluginManager hook is triggered 97 // Make sure that PluginManager hook is triggered
98 $this->container->pluginManager 98 $this->container->pluginManager
99 ->expects(static::at(0)) 99 ->expects(static::atLeastOnce())
100 ->method('executeHooks') 100 ->method('executeHooks')
101 ->withConsecutive(['render_editlink'], ['render_includes'])
101 ->willReturnCallback(function (string $hook, array $data) use ($remoteTitle, $remoteDesc): array { 102 ->willReturnCallback(function (string $hook, array $data) use ($remoteTitle, $remoteDesc): array {
102 static::assertSame('render_editlink', $hook); 103 if ('render_editlink' === $hook) {
103 static::assertSame($remoteTitle, $data['link']['title']); 104 static::assertSame($remoteTitle, $data['link']['title']);
104 static::assertSame($remoteDesc, $data['link']['description']); 105 static::assertSame($remoteDesc, $data['link']['description']);
106 }
105 107
106 return $data; 108 return $data;
107 }) 109 })
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php
index 1a1cdcf3..2dc3f41c 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php
@@ -4,13 +4,13 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
10use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; 9use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
11use Shaarli\Front\Controller\Admin\ManageShaareController; 10use Shaarli\Front\Controller\Admin\ManageShaareController;
12use Shaarli\Http\HttpAccess; 11use Shaarli\Http\HttpAccess;
13use Shaarli\Security\SessionManager; 12use Shaarli\Security\SessionManager;
13use Shaarli\TestCase;
14use Slim\Http\Request; 14use Slim\Http\Request;
15use Slim\Http\Response; 15use Slim\Http\Response;
16 16
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php
index 1607b475..50ce7df1 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php
@@ -4,13 +4,13 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
10use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; 9use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
11use Shaarli\Front\Controller\Admin\ManageShaareController; 10use Shaarli\Front\Controller\Admin\ManageShaareController;
12use Shaarli\Http\HttpAccess; 11use Shaarli\Http\HttpAccess;
13use Shaarli\Security\SessionManager; 12use Shaarli\Security\SessionManager;
13use Shaarli\TestCase;
14use Slim\Http\Request; 14use Slim\Http\Request;
15use Slim\Http\Response; 15use Slim\Http\Response;
16 16
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
index 58eaaa9b..3999b44e 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; 5namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; 9use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper;
@@ -12,6 +11,7 @@ use Shaarli\Front\Controller\Admin\ManageShaareController;
12use Shaarli\Front\Exception\WrongTokenException; 11use Shaarli\Front\Exception\WrongTokenException;
13use Shaarli\Http\HttpAccess; 12use Shaarli\Http\HttpAccess;
14use Shaarli\Security\SessionManager; 13use Shaarli\Security\SessionManager;
14use Shaarli\TestCase;
15use Shaarli\Thumbnailer; 15use Shaarli\Thumbnailer;
16use Slim\Http\Request; 16use Slim\Http\Request;
17use Slim\Http\Response; 17use Slim\Http\Response;
@@ -88,17 +88,18 @@ class SaveBookmarkTest extends TestCase
88 88
89 // Make sure that PluginManager hook is triggered 89 // Make sure that PluginManager hook is triggered
90 $this->container->pluginManager 90 $this->container->pluginManager
91 ->expects(static::at(0)) 91 ->expects(static::atLeastOnce())
92 ->method('executeHooks') 92 ->method('executeHooks')
93 ->withConsecutive(['save_link'])
93 ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array { 94 ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array {
94 static::assertSame('save_link', $hook); 95 if ('save_link' === $hook) {
95 96 static::assertSame($id, $data['id']);
96 static::assertSame($id, $data['id']); 97 static::assertSame($parameters['lf_url'], $data['url']);
97 static::assertSame($parameters['lf_url'], $data['url']); 98 static::assertSame($parameters['lf_title'], $data['title']);
98 static::assertSame($parameters['lf_title'], $data['title']); 99 static::assertSame($parameters['lf_description'], $data['description']);
99 static::assertSame($parameters['lf_description'], $data['description']); 100 static::assertSame($parameters['lf_tags'], $data['tags']);
100 static::assertSame($parameters['lf_tags'], $data['tags']); 101 static::assertTrue($data['private']);
101 static::assertTrue($data['private']); 102 }
102 103
103 return $data; 104 return $data;
104 }) 105 })
@@ -174,17 +175,18 @@ class SaveBookmarkTest extends TestCase
174 175
175 // Make sure that PluginManager hook is triggered 176 // Make sure that PluginManager hook is triggered
176 $this->container->pluginManager 177 $this->container->pluginManager
177 ->expects(static::at(0)) 178 ->expects(static::atLeastOnce())
178 ->method('executeHooks') 179 ->method('executeHooks')
180 ->withConsecutive(['save_link'])
179 ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array { 181 ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array {
180 static::assertSame('save_link', $hook); 182 if ('save_link' === $hook) {
181 183 static::assertSame($id, $data['id']);
182 static::assertSame($id, $data['id']); 184 static::assertSame($parameters['lf_url'], $data['url']);
183 static::assertSame($parameters['lf_url'], $data['url']); 185 static::assertSame($parameters['lf_title'], $data['title']);
184 static::assertSame($parameters['lf_title'], $data['title']); 186 static::assertSame($parameters['lf_description'], $data['description']);
185 static::assertSame($parameters['lf_description'], $data['description']); 187 static::assertSame($parameters['lf_tags'], $data['tags']);
186 static::assertSame($parameters['lf_tags'], $data['tags']); 188 static::assertTrue($data['private']);
187 static::assertTrue($data['private']); 189 }
188 190
189 return $data; 191 return $data;
190 }) 192 })
diff --git a/tests/front/controller/admin/ManageTagControllerTest.php b/tests/front/controller/admin/ManageTagControllerTest.php
index 09ba0b4b..8a0ff7a9 100644
--- a/tests/front/controller/admin/ManageTagControllerTest.php
+++ b/tests/front/controller/admin/ManageTagControllerTest.php
@@ -4,11 +4,11 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\BookmarkFilter; 8use Shaarli\Bookmark\BookmarkFilter;
10use Shaarli\Front\Exception\WrongTokenException; 9use Shaarli\Front\Exception\WrongTokenException;
11use Shaarli\Security\SessionManager; 10use Shaarli\Security\SessionManager;
11use Shaarli\TestCase;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
diff --git a/tests/front/controller/admin/PasswordControllerTest.php b/tests/front/controller/admin/PasswordControllerTest.php
index 9a01089e..58f47b49 100644
--- a/tests/front/controller/admin/PasswordControllerTest.php
+++ b/tests/front/controller/admin/PasswordControllerTest.php
@@ -4,11 +4,11 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\OpenShaarliPasswordException; 8use Shaarli\Front\Exception\OpenShaarliPasswordException;
10use Shaarli\Front\Exception\WrongTokenException; 9use Shaarli\Front\Exception\WrongTokenException;
11use Shaarli\Security\SessionManager; 10use Shaarli\Security\SessionManager;
11use Shaarli\TestCase;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
diff --git a/tests/front/controller/admin/PluginsControllerTest.php b/tests/front/controller/admin/PluginsControllerTest.php
index 9526474c..974d614d 100644
--- a/tests/front/controller/admin/PluginsControllerTest.php
+++ b/tests/front/controller/admin/PluginsControllerTest.php
@@ -4,11 +4,11 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\WrongTokenException; 8use Shaarli\Front\Exception\WrongTokenException;
10use Shaarli\Plugin\PluginManager; 9use Shaarli\Plugin\PluginManager;
11use Shaarli\Security\SessionManager; 10use Shaarli\Security\SessionManager;
11use Shaarli\TestCase;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14 14
diff --git a/tests/front/controller/admin/SessionFilterControllerTest.php b/tests/front/controller/admin/SessionFilterControllerTest.php
index c4253167..712a625b 100644
--- a/tests/front/controller/admin/SessionFilterControllerTest.php
+++ b/tests/front/controller/admin/SessionFilterControllerTest.php
@@ -4,9 +4,9 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Security\LoginManager; 7use Shaarli\Security\LoginManager;
9use Shaarli\Security\SessionManager; 8use Shaarli\Security\SessionManager;
9use Shaarli\TestCase;
10use Slim\Http\Request; 10use Slim\Http\Request;
11use Slim\Http\Response; 11use Slim\Http\Response;
12 12
diff --git a/tests/front/controller/admin/ShaarliAdminControllerTest.php b/tests/front/controller/admin/ShaarliAdminControllerTest.php
index fff427cb..486d5d2d 100644
--- a/tests/front/controller/admin/ShaarliAdminControllerTest.php
+++ b/tests/front/controller/admin/ShaarliAdminControllerTest.php
@@ -4,9 +4,9 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Exception\WrongTokenException; 7use Shaarli\Front\Exception\WrongTokenException;
9use Shaarli\Security\SessionManager; 8use Shaarli\Security\SessionManager;
9use Shaarli\TestCase;
10use Slim\Http\Request; 10use Slim\Http\Request;
11 11
12/** 12/**
diff --git a/tests/front/controller/admin/ThumbnailsControllerTest.php b/tests/front/controller/admin/ThumbnailsControllerTest.php
index 0c0c8a83..f4a8acff 100644
--- a/tests/front/controller/admin/ThumbnailsControllerTest.php
+++ b/tests/front/controller/admin/ThumbnailsControllerTest.php
@@ -4,9 +4,9 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
9use Shaarli\TestCase;
10use Shaarli\Thumbnailer; 10use Shaarli\Thumbnailer;
11use Slim\Http\Request; 11use Slim\Http\Request;
12use Slim\Http\Response; 12use Slim\Http\Response;
diff --git a/tests/front/controller/admin/TokenControllerTest.php b/tests/front/controller/admin/TokenControllerTest.php
index 04b0c0fa..d2f0907f 100644
--- a/tests/front/controller/admin/TokenControllerTest.php
+++ b/tests/front/controller/admin/TokenControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
9use Slim\Http\Response; 9use Slim\Http\Response;
10 10
diff --git a/tests/front/controller/admin/ToolsControllerTest.php b/tests/front/controller/admin/ToolsControllerTest.php
index 39144d2f..e82f8b14 100644
--- a/tests/front/controller/admin/ToolsControllerTest.php
+++ b/tests/front/controller/admin/ToolsControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Admin; 5namespace Shaarli\Front\Controller\Admin;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
9use Slim\Http\Response; 9use Slim\Http\Response;
10 10
diff --git a/tests/front/controller/visitor/BookmarkListControllerTest.php b/tests/front/controller/visitor/BookmarkListControllerTest.php
index 5daaa2c4..0c95df97 100644
--- a/tests/front/controller/visitor/BookmarkListControllerTest.php
+++ b/tests/front/controller/visitor/BookmarkListControllerTest.php
@@ -4,11 +4,11 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
10use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
11use Shaarli\Security\LoginManager; 10use Shaarli\Security\LoginManager;
11use Shaarli\TestCase;
12use Shaarli\Thumbnailer; 12use Shaarli\Thumbnailer;
13use Slim\Http\Request; 13use Slim\Http\Request;
14use Slim\Http\Response; 14use Slim\Http\Response;
diff --git a/tests/front/controller/visitor/DailyControllerTest.php b/tests/front/controller/visitor/DailyControllerTest.php
index cb5b96f3..fc78bc13 100644
--- a/tests/front/controller/visitor/DailyControllerTest.php
+++ b/tests/front/controller/visitor/DailyControllerTest.php
@@ -4,9 +4,9 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Feed\CachedPage; 8use Shaarli\Feed\CachedPage;
9use Shaarli\TestCase;
10use Slim\Http\Request; 10use Slim\Http\Request;
11use Slim\Http\Response; 11use Slim\Http\Response;
12 12
@@ -78,19 +78,20 @@ class DailyControllerTest extends TestCase
78 78
79 // Make sure that PluginManager hook is triggered 79 // Make sure that PluginManager hook is triggered
80 $this->container->pluginManager 80 $this->container->pluginManager
81 ->expects(static::at(0)) 81 ->expects(static::atLeastOnce())
82 ->method('executeHooks') 82 ->method('executeHooks')
83 ->withConsecutive(['render_daily'])
83 ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array { 84 ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array {
84 static::assertSame('render_daily', $hook); 85 if ('render_daily' === $hook) {
86 static::assertArrayHasKey('linksToDisplay', $data);
87 static::assertCount(3, $data['linksToDisplay']);
88 static::assertSame(1, $data['linksToDisplay'][0]['id']);
89 static::assertSame($currentDay->getTimestamp(), $data['day']);
90 static::assertSame('20200510', $data['previousday']);
91 static::assertSame('20200516', $data['nextday']);
85 92
86 static::assertArrayHasKey('linksToDisplay', $data); 93 static::assertArrayHasKey('loggedin', $param);
87 static::assertCount(3, $data['linksToDisplay']); 94 }
88 static::assertSame(1, $data['linksToDisplay'][0]['id']);
89 static::assertSame($currentDay->getTimestamp(), $data['day']);
90 static::assertSame('20200510', $data['previousday']);
91 static::assertSame('20200516', $data['nextday']);
92
93 static::assertArrayHasKey('loggedin', $param);
94 95
95 return $data; 96 return $data;
96 }) 97 })
@@ -203,19 +204,20 @@ class DailyControllerTest extends TestCase
203 204
204 // Make sure that PluginManager hook is triggered 205 // Make sure that PluginManager hook is triggered
205 $this->container->pluginManager 206 $this->container->pluginManager
206 ->expects(static::at(0)) 207 ->expects(static::atLeastOnce())
207 ->method('executeHooks') 208 ->method('executeHooks')
209 ->withConsecutive(['render_daily'])
208 ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array { 210 ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array {
209 static::assertSame('render_daily', $hook); 211 if ('render_daily' === $hook) {
210 212 static::assertArrayHasKey('linksToDisplay', $data);
211 static::assertArrayHasKey('linksToDisplay', $data); 213 static::assertCount(1, $data['linksToDisplay']);
212 static::assertCount(1, $data['linksToDisplay']); 214 static::assertSame(1, $data['linksToDisplay'][0]['id']);
213 static::assertSame(1, $data['linksToDisplay'][0]['id']); 215 static::assertSame($currentDay->getTimestamp(), $data['day']);
214 static::assertSame($currentDay->getTimestamp(), $data['day']); 216 static::assertEmpty($data['previousday']);
215 static::assertEmpty($data['previousday']); 217 static::assertEmpty($data['nextday']);
216 static::assertEmpty($data['nextday']);
217 218
218 static::assertArrayHasKey('loggedin', $param); 219 static::assertArrayHasKey('loggedin', $param);
220 }
219 221
220 return $data; 222 return $data;
221 }); 223 });
@@ -281,7 +283,7 @@ class DailyControllerTest extends TestCase
281 283
282 // Make sure that PluginManager hook is triggered 284 // Make sure that PluginManager hook is triggered
283 $this->container->pluginManager 285 $this->container->pluginManager
284 ->expects(static::at(0)) 286 ->expects(static::atLeastOnce())
285 ->method('executeHooks') 287 ->method('executeHooks')
286 ->willReturnCallback(function (string $hook, array $data, array $param): array { 288 ->willReturnCallback(function (string $hook, array $data, array $param): array {
287 return $data; 289 return $data;
@@ -333,7 +335,7 @@ class DailyControllerTest extends TestCase
333 335
334 // Make sure that PluginManager hook is triggered 336 // Make sure that PluginManager hook is triggered
335 $this->container->pluginManager 337 $this->container->pluginManager
336 ->expects(static::at(0)) 338 ->expects(static::atLeastOnce())
337 ->method('executeHooks') 339 ->method('executeHooks')
338 ->willReturnCallback(function (string $hook, array $data, array $param): array { 340 ->willReturnCallback(function (string $hook, array $data, array $param): array {
339 return $data; 341 return $data;
diff --git a/tests/front/controller/visitor/ErrorControllerTest.php b/tests/front/controller/visitor/ErrorControllerTest.php
index e497bfef..75408cf4 100644
--- a/tests/front/controller/visitor/ErrorControllerTest.php
+++ b/tests/front/controller/visitor/ErrorControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Exception\ShaarliFrontException; 7use Shaarli\Front\Exception\ShaarliFrontException;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
diff --git a/tests/front/controller/visitor/ErrorNotFoundControllerTest.php b/tests/front/controller/visitor/ErrorNotFoundControllerTest.php
index 625467b1..a1cbbecf 100644
--- a/tests/front/controller/visitor/ErrorNotFoundControllerTest.php
+++ b/tests/front/controller/visitor/ErrorNotFoundControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
9use Slim\Http\Response; 9use Slim\Http\Response;
10use Slim\Http\Uri; 10use Slim\Http\Uri;
diff --git a/tests/front/controller/visitor/FeedControllerTest.php b/tests/front/controller/visitor/FeedControllerTest.php
index 0a6b577f..4ae7c925 100644
--- a/tests/front/controller/visitor/FeedControllerTest.php
+++ b/tests/front/controller/visitor/FeedControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Feed\FeedBuilder; 7use Shaarli\Feed\FeedBuilder;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
@@ -45,14 +45,16 @@ class FeedControllerTest extends TestCase
45 45
46 // Make sure that PluginManager hook is triggered 46 // Make sure that PluginManager hook is triggered
47 $this->container->pluginManager 47 $this->container->pluginManager
48 ->expects(static::at(0)) 48 ->expects(static::atLeastOnce())
49 ->method('executeHooks') 49 ->method('executeHooks')
50 ->withConsecutive(['render_feed'])
50 ->willReturnCallback(function (string $hook, array $data, array $param): void { 51 ->willReturnCallback(function (string $hook, array $data, array $param): void {
51 static::assertSame('render_feed', $hook); 52 if ('render_feed' === $hook) {
52 static::assertSame('data', $data['content']); 53 static::assertSame('data', $data['content']);
53 54
54 static::assertArrayHasKey('loggedin', $param); 55 static::assertArrayHasKey('loggedin', $param);
55 static::assertSame('feed.rss', $param['target']); 56 static::assertSame('feed.rss', $param['target']);
57 }
56 }) 58 })
57 ; 59 ;
58 60
@@ -84,14 +86,16 @@ class FeedControllerTest extends TestCase
84 86
85 // Make sure that PluginManager hook is triggered 87 // Make sure that PluginManager hook is triggered
86 $this->container->pluginManager 88 $this->container->pluginManager
87 ->expects(static::at(0)) 89 ->expects(static::atLeastOnce())
88 ->method('executeHooks') 90 ->method('executeHooks')
91 ->withConsecutive(['render_feed'])
89 ->willReturnCallback(function (string $hook, array $data, array $param): void { 92 ->willReturnCallback(function (string $hook, array $data, array $param): void {
90 static::assertSame('render_feed', $hook); 93 if ('render_feed' === $hook) {
91 static::assertSame('data', $data['content']); 94 static::assertSame('data', $data['content']);
92 95
93 static::assertArrayHasKey('loggedin', $param); 96 static::assertArrayHasKey('loggedin', $param);
94 static::assertSame('feed.atom', $param['target']); 97 static::assertSame('feed.atom', $param['target']);
98 }
95 }) 99 })
96 ; 100 ;
97 101
@@ -124,14 +128,16 @@ class FeedControllerTest extends TestCase
124 128
125 // Make sure that PluginManager hook is triggered 129 // Make sure that PluginManager hook is triggered
126 $this->container->pluginManager 130 $this->container->pluginManager
127 ->expects(static::at(0)) 131 ->expects(static::atLeastOnce())
128 ->method('executeHooks') 132 ->method('executeHooks')
133 ->withConsecutive(['render_feed'])
129 ->willReturnCallback(function (string $hook, array $data, array $param): void { 134 ->willReturnCallback(function (string $hook, array $data, array $param): void {
130 static::assertSame('render_feed', $hook); 135 if ('render_feed' === $hook) {
131 static::assertSame('data', $data['content']); 136 static::assertSame('data', $data['content']);
132 137
133 static::assertArrayHasKey('loggedin', $param); 138 static::assertArrayHasKey('loggedin', $param);
134 static::assertSame('feed.atom', $param['target']); 139 static::assertSame('feed.atom', $param['target']);
140 }
135 }) 141 })
136 ; 142 ;
137 143
diff --git a/tests/front/controller/visitor/FrontControllerMockHelper.php b/tests/front/controller/visitor/FrontControllerMockHelper.php
index 6c53289b..fc0bb7d1 100644
--- a/tests/front/controller/visitor/FrontControllerMockHelper.php
+++ b/tests/front/controller/visitor/FrontControllerMockHelper.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\MockObject\MockObject;
8use Shaarli\Bookmark\BookmarkServiceInterface; 7use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Container\ShaarliTestContainer; 9use Shaarli\Container\ShaarliTestContainer;
@@ -115,5 +114,5 @@ trait FrontControllerMockHelper
115 /** 114 /**
116 * Force to be used in PHPUnit context. 115 * Force to be used in PHPUnit context.
117 */ 116 */
118 protected abstract function createMock($originalClassName): MockObject; 117 protected abstract function isInTestsContext(): bool;
119} 118}
diff --git a/tests/front/controller/visitor/InstallControllerTest.php b/tests/front/controller/visitor/InstallControllerTest.php
index 994d3f33..345ad544 100644
--- a/tests/front/controller/visitor/InstallControllerTest.php
+++ b/tests/front/controller/visitor/InstallControllerTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\AlreadyInstalledException; 8use Shaarli\Front\Exception\AlreadyInstalledException;
10use Shaarli\Security\SessionManager; 9use Shaarli\Security\SessionManager;
10use Shaarli\TestCase;
11use Slim\Http\Request; 11use Slim\Http\Request;
12use Slim\Http\Response; 12use Slim\Http\Response;
13 13
diff --git a/tests/front/controller/visitor/LoginControllerTest.php b/tests/front/controller/visitor/LoginControllerTest.php
index 0a21f938..1312ccb7 100644
--- a/tests/front/controller/visitor/LoginControllerTest.php
+++ b/tests/front/controller/visitor/LoginControllerTest.php
@@ -4,13 +4,13 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\Front\Exception\LoginBannedException; 8use Shaarli\Front\Exception\LoginBannedException;
10use Shaarli\Front\Exception\WrongTokenException; 9use Shaarli\Front\Exception\WrongTokenException;
11use Shaarli\Render\TemplatePage; 10use Shaarli\Render\TemplatePage;
12use Shaarli\Security\CookieManager; 11use Shaarli\Security\CookieManager;
13use Shaarli\Security\SessionManager; 12use Shaarli\Security\SessionManager;
13use Shaarli\TestCase;
14use Slim\Http\Request; 14use Slim\Http\Request;
15use Slim\Http\Response; 15use Slim\Http\Response;
16 16
diff --git a/tests/front/controller/visitor/OpenSearchControllerTest.php b/tests/front/controller/visitor/OpenSearchControllerTest.php
index 9609a377..42d876c3 100644
--- a/tests/front/controller/visitor/OpenSearchControllerTest.php
+++ b/tests/front/controller/visitor/OpenSearchControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
9use Slim\Http\Response; 9use Slim\Http\Response;
10 10
diff --git a/tests/front/controller/visitor/PictureWallControllerTest.php b/tests/front/controller/visitor/PictureWallControllerTest.php
index 3dc3f292..b868231d 100644
--- a/tests/front/controller/visitor/PictureWallControllerTest.php
+++ b/tests/front/controller/visitor/PictureWallControllerTest.php
@@ -4,10 +4,10 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Front\Exception\ThumbnailsDisabledException; 9use Shaarli\Front\Exception\ThumbnailsDisabledException;
10use Shaarli\TestCase;
11use Shaarli\Thumbnailer; 11use Shaarli\Thumbnailer;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
@@ -67,15 +67,17 @@ class PictureWallControllerTest extends TestCase
67 67
68 // Make sure that PluginManager hook is triggered 68 // Make sure that PluginManager hook is triggered
69 $this->container->pluginManager 69 $this->container->pluginManager
70 ->expects(static::at(0)) 70 ->expects(static::atLeastOnce())
71 ->method('executeHooks') 71 ->method('executeHooks')
72 ->withConsecutive(['render_picwall'])
72 ->willReturnCallback(function (string $hook, array $data, array $param): array { 73 ->willReturnCallback(function (string $hook, array $data, array $param): array {
73 static::assertSame('render_picwall', $hook); 74 if ('render_picwall' === $hook) {
74 static::assertArrayHasKey('linksToDisplay', $data); 75 static::assertArrayHasKey('linksToDisplay', $data);
75 static::assertCount(2, $data['linksToDisplay']); 76 static::assertCount(2, $data['linksToDisplay']);
76 static::assertSame(1, $data['linksToDisplay'][0]['id']); 77 static::assertSame(1, $data['linksToDisplay'][0]['id']);
77 static::assertSame(3, $data['linksToDisplay'][1]['id']); 78 static::assertSame(3, $data['linksToDisplay'][1]['id']);
78 static::assertArrayHasKey('loggedin', $param); 79 static::assertArrayHasKey('loggedin', $param);
80 }
79 81
80 return $data; 82 return $data;
81 }); 83 });
diff --git a/tests/front/controller/visitor/PublicSessionFilterControllerTest.php b/tests/front/controller/visitor/PublicSessionFilterControllerTest.php
index b45fbe53..7e3b00af 100644
--- a/tests/front/controller/visitor/PublicSessionFilterControllerTest.php
+++ b/tests/front/controller/visitor/PublicSessionFilterControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Security\SessionManager; 7use Shaarli\Security\SessionManager;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
diff --git a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php
index 00188c02..935ec24e 100644
--- a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php
+++ b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkFilter; 7use Shaarli\Bookmark\BookmarkFilter;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
diff --git a/tests/front/controller/visitor/TagCloudControllerTest.php b/tests/front/controller/visitor/TagCloudControllerTest.php
index 9a6a4bc0..9305612e 100644
--- a/tests/front/controller/visitor/TagCloudControllerTest.php
+++ b/tests/front/controller/visitor/TagCloudControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkFilter; 7use Shaarli\Bookmark\BookmarkFilter;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
@@ -53,14 +53,16 @@ class TagCloudControllerTest extends TestCase
53 53
54 // Make sure that PluginManager hook is triggered 54 // Make sure that PluginManager hook is triggered
55 $this->container->pluginManager 55 $this->container->pluginManager
56 ->expects(static::at(0)) 56 ->expects(static::atLeastOnce())
57 ->method('executeHooks') 57 ->method('executeHooks')
58 ->withConsecutive(['render_tagcloud'])
58 ->willReturnCallback(function (string $hook, array $data, array $param): array { 59 ->willReturnCallback(function (string $hook, array $data, array $param): array {
59 static::assertSame('render_tagcloud', $hook); 60 if ('render_tagcloud' === $hook) {
60 static::assertSame('', $data['search_tags']); 61 static::assertSame('', $data['search_tags']);
61 static::assertCount(3, $data['tags']); 62 static::assertCount(3, $data['tags']);
62 63
63 static::assertArrayHasKey('loggedin', $param); 64 static::assertArrayHasKey('loggedin', $param);
65 }
64 66
65 return $data; 67 return $data;
66 }) 68 })
@@ -124,14 +126,16 @@ class TagCloudControllerTest extends TestCase
124 126
125 // Make sure that PluginManager hook is triggered 127 // Make sure that PluginManager hook is triggered
126 $this->container->pluginManager 128 $this->container->pluginManager
127 ->expects(static::at(0)) 129 ->expects(static::atLeastOnce())
128 ->method('executeHooks') 130 ->method('executeHooks')
131 ->withConsecutive(['render_tagcloud'])
129 ->willReturnCallback(function (string $hook, array $data, array $param): array { 132 ->willReturnCallback(function (string $hook, array $data, array $param): array {
130 static::assertSame('render_tagcloud', $hook); 133 if ('render_tagcloud' === $hook) {
131 static::assertSame('ghi def', $data['search_tags']); 134 static::assertSame('ghi def', $data['search_tags']);
132 static::assertCount(1, $data['tags']); 135 static::assertCount(1, $data['tags']);
133 136
134 static::assertArrayHasKey('loggedin', $param); 137 static::assertArrayHasKey('loggedin', $param);
138 }
135 139
136 return $data; 140 return $data;
137 }) 141 })
@@ -175,14 +179,16 @@ class TagCloudControllerTest extends TestCase
175 179
176 // Make sure that PluginManager hook is triggered 180 // Make sure that PluginManager hook is triggered
177 $this->container->pluginManager 181 $this->container->pluginManager
178 ->expects(static::at(0)) 182 ->expects(static::atLeastOnce())
179 ->method('executeHooks') 183 ->method('executeHooks')
184 ->withConsecutive(['render_tagcloud'])
180 ->willReturnCallback(function (string $hook, array $data, array $param): array { 185 ->willReturnCallback(function (string $hook, array $data, array $param): array {
181 static::assertSame('render_tagcloud', $hook); 186 if ('render_tagcloud' === $hook) {
182 static::assertSame('', $data['search_tags']); 187 static::assertSame('', $data['search_tags']);
183 static::assertCount(0, $data['tags']); 188 static::assertCount(0, $data['tags']);
184 189
185 static::assertArrayHasKey('loggedin', $param); 190 static::assertArrayHasKey('loggedin', $param);
191 }
186 192
187 return $data; 193 return $data;
188 }) 194 })
@@ -227,14 +233,16 @@ class TagCloudControllerTest extends TestCase
227 233
228 // Make sure that PluginManager hook is triggered 234 // Make sure that PluginManager hook is triggered
229 $this->container->pluginManager 235 $this->container->pluginManager
230 ->expects(static::at(0)) 236 ->expects(static::atLeastOnce())
231 ->method('executeHooks') 237 ->method('executeHooks')
238 ->withConsecutive(['render_taglist'])
232 ->willReturnCallback(function (string $hook, array $data, array $param): array { 239 ->willReturnCallback(function (string $hook, array $data, array $param): array {
233 static::assertSame('render_taglist', $hook); 240 if ('render_taglist' === $hook) {
234 static::assertSame('', $data['search_tags']); 241 static::assertSame('', $data['search_tags']);
235 static::assertCount(3, $data['tags']); 242 static::assertCount(3, $data['tags']);
236 243
237 static::assertArrayHasKey('loggedin', $param); 244 static::assertArrayHasKey('loggedin', $param);
245 }
238 246
239 return $data; 247 return $data;
240 }) 248 })
@@ -297,14 +305,16 @@ class TagCloudControllerTest extends TestCase
297 305
298 // Make sure that PluginManager hook is triggered 306 // Make sure that PluginManager hook is triggered
299 $this->container->pluginManager 307 $this->container->pluginManager
300 ->expects(static::at(0)) 308 ->expects(static::atLeastOnce())
301 ->method('executeHooks') 309 ->method('executeHooks')
310 ->withConsecutive(['render_taglist'])
302 ->willReturnCallback(function (string $hook, array $data, array $param): array { 311 ->willReturnCallback(function (string $hook, array $data, array $param): array {
303 static::assertSame('render_taglist', $hook); 312 if ('render_taglist' === $hook) {
304 static::assertSame('ghi def', $data['search_tags']); 313 static::assertSame('ghi def', $data['search_tags']);
305 static::assertCount(1, $data['tags']); 314 static::assertCount(1, $data['tags']);
306 315
307 static::assertArrayHasKey('loggedin', $param); 316 static::assertArrayHasKey('loggedin', $param);
317 }
308 318
309 return $data; 319 return $data;
310 }) 320 })
@@ -344,14 +354,16 @@ class TagCloudControllerTest extends TestCase
344 354
345 // Make sure that PluginManager hook is triggered 355 // Make sure that PluginManager hook is triggered
346 $this->container->pluginManager 356 $this->container->pluginManager
347 ->expects(static::at(0)) 357 ->expects(static::atLeastOnce())
348 ->method('executeHooks') 358 ->method('executeHooks')
359 ->withConsecutive(['render_taglist'])
349 ->willReturnCallback(function (string $hook, array $data, array $param): array { 360 ->willReturnCallback(function (string $hook, array $data, array $param): array {
350 static::assertSame('render_taglist', $hook); 361 if ('render_taglist' === $hook) {
351 static::assertSame('', $data['search_tags']); 362 static::assertSame('', $data['search_tags']);
352 static::assertCount(0, $data['tags']); 363 static::assertCount(0, $data['tags']);
353 364
354 static::assertArrayHasKey('loggedin', $param); 365 static::assertArrayHasKey('loggedin', $param);
366 }
355 367
356 return $data; 368 return $data;
357 }) 369 })
diff --git a/tests/front/controller/visitor/TagControllerTest.php b/tests/front/controller/visitor/TagControllerTest.php
index 43076086..750ea02d 100644
--- a/tests/front/controller/visitor/TagControllerTest.php
+++ b/tests/front/controller/visitor/TagControllerTest.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8use Slim\Http\Request; 8use Slim\Http\Request;
9use Slim\Http\Response; 9use Slim\Http\Response;
10 10
diff --git a/tests/http/HttpUtils/ClientIpIdTest.php b/tests/http/HttpUtils/ClientIpIdTest.php
index 982e57e0..3a0fcf30 100644
--- a/tests/http/HttpUtils/ClientIpIdTest.php
+++ b/tests/http/HttpUtils/ClientIpIdTest.php
@@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php';
10/** 10/**
11 * Unitary tests for client_ip_id() 11 * Unitary tests for client_ip_id()
12 */ 12 */
13class ClientIpIdTest extends \PHPUnit\Framework\TestCase 13class ClientIpIdTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * Get a remote client ID based on its IP 16 * Get a remote client ID based on its IP
diff --git a/tests/http/HttpUtils/GetHttpUrlTest.php b/tests/http/HttpUtils/GetHttpUrlTest.php
index 3dc5bc9b..a868ac02 100644
--- a/tests/http/HttpUtils/GetHttpUrlTest.php
+++ b/tests/http/HttpUtils/GetHttpUrlTest.php
@@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php';
10/** 10/**
11 * Unitary tests for get_http_response() 11 * Unitary tests for get_http_response()
12 */ 12 */
13class GetHttpUrlTest extends \PHPUnit\Framework\TestCase 13class GetHttpUrlTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * Get an invalid local URL 16 * Get an invalid local URL
diff --git a/tests/http/HttpUtils/GetIpAdressFromProxyTest.php b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php
index fe3a639e..60cdb992 100644
--- a/tests/http/HttpUtils/GetIpAdressFromProxyTest.php
+++ b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php
@@ -7,7 +7,7 @@ require_once 'application/http/HttpUtils.php';
7/** 7/**
8 * Unitary tests for getIpAddressFromProxy() 8 * Unitary tests for getIpAddressFromProxy()
9 */ 9 */
10class GetIpAdressFromProxyTest extends \PHPUnit\Framework\TestCase 10class GetIpAdressFromProxyTest extends \Shaarli\TestCase
11{ 11{
12 12
13 /** 13 /**
diff --git a/tests/http/HttpUtils/IndexUrlTest.php b/tests/http/HttpUtils/IndexUrlTest.php
index cce45c51..f283d119 100644
--- a/tests/http/HttpUtils/IndexUrlTest.php
+++ b/tests/http/HttpUtils/IndexUrlTest.php
@@ -5,7 +5,7 @@
5 5
6namespace Shaarli\Http; 6namespace Shaarli\Http;
7 7
8use PHPUnit\Framework\TestCase; 8use Shaarli\TestCase;
9 9
10require_once 'application/http/HttpUtils.php'; 10require_once 'application/http/HttpUtils.php';
11 11
diff --git a/tests/http/HttpUtils/IndexUrlTestWithConstant.php b/tests/http/HttpUtils/IndexUrlTestWithConstant.php
index 15ca3d72..ecaea724 100644
--- a/tests/http/HttpUtils/IndexUrlTestWithConstant.php
+++ b/tests/http/HttpUtils/IndexUrlTestWithConstant.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Http; 5namespace Shaarli\Http;
6 6
7use PHPUnit\Framework\TestCase; 7use Shaarli\TestCase;
8 8
9/** 9/**
10 * Test index_url with SHAARLI_ROOT_URL defined to override automatic retrieval. 10 * Test index_url with SHAARLI_ROOT_URL defined to override automatic retrieval.
diff --git a/tests/http/HttpUtils/IsHttpsTest.php b/tests/http/HttpUtils/IsHttpsTest.php
index 348956c6..8b3fd93d 100644
--- a/tests/http/HttpUtils/IsHttpsTest.php
+++ b/tests/http/HttpUtils/IsHttpsTest.php
@@ -9,7 +9,7 @@ require_once 'application/http/HttpUtils.php';
9 * 9 *
10 * Test class for is_https() function. 10 * Test class for is_https() function.
11 */ 11 */
12class IsHttpsTest extends \PHPUnit\Framework\TestCase 12class IsHttpsTest extends \Shaarli\TestCase
13{ 13{
14 14
15 /** 15 /**
diff --git a/tests/http/HttpUtils/PageUrlTest.php b/tests/http/HttpUtils/PageUrlTest.php
index f1991716..ebb3e617 100644
--- a/tests/http/HttpUtils/PageUrlTest.php
+++ b/tests/http/HttpUtils/PageUrlTest.php
@@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php';
10/** 10/**
11 * Unitary tests for page_url() 11 * Unitary tests for page_url()
12 */ 12 */
13class PageUrlTest extends \PHPUnit\Framework\TestCase 13class PageUrlTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * If on the main page, remove "index.php" from the URL resource 16 * If on the main page, remove "index.php" from the URL resource
diff --git a/tests/http/HttpUtils/ServerUrlTest.php b/tests/http/HttpUtils/ServerUrlTest.php
index 9caf1049..339664e1 100644
--- a/tests/http/HttpUtils/ServerUrlTest.php
+++ b/tests/http/HttpUtils/ServerUrlTest.php
@@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php';
10/** 10/**
11 * Unitary tests for server_url() 11 * Unitary tests for server_url()
12 */ 12 */
13class ServerUrlTest extends \PHPUnit\Framework\TestCase 13class ServerUrlTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * Detect if the server uses SSL 16 * Detect if the server uses SSL
diff --git a/tests/http/UrlTest.php b/tests/http/UrlTest.php
index ae92f73a..c6b39c29 100644
--- a/tests/http/UrlTest.php
+++ b/tests/http/UrlTest.php
@@ -8,7 +8,7 @@ namespace Shaarli\Http;
8/** 8/**
9 * Unitary tests for URL utilities 9 * Unitary tests for URL utilities
10 */ 10 */
11class UrlTest extends \PHPUnit\Framework\TestCase 11class UrlTest extends \Shaarli\TestCase
12{ 12{
13 // base URL for tests 13 // base URL for tests
14 protected static $baseUrl = 'http://domain.tld:3000'; 14 protected static $baseUrl = 'http://domain.tld:3000';
diff --git a/tests/http/UrlUtils/CleanupUrlTest.php b/tests/http/UrlUtils/CleanupUrlTest.php
index 6c4d124b..45690ecf 100644
--- a/tests/http/UrlUtils/CleanupUrlTest.php
+++ b/tests/http/UrlUtils/CleanupUrlTest.php
@@ -7,7 +7,7 @@ namespace Shaarli\Http;
7 7
8require_once 'application/http/UrlUtils.php'; 8require_once 'application/http/UrlUtils.php';
9 9
10class CleanupUrlTest extends \PHPUnit\Framework\TestCase 10class CleanupUrlTest extends \Shaarli\TestCase
11{ 11{
12 /** 12 /**
13 * @var string reference URL 13 * @var string reference URL
diff --git a/tests/http/UrlUtils/GetUrlSchemeTest.php b/tests/http/UrlUtils/GetUrlSchemeTest.php
index 2b97f7be..18a9a5e5 100644
--- a/tests/http/UrlUtils/GetUrlSchemeTest.php
+++ b/tests/http/UrlUtils/GetUrlSchemeTest.php
@@ -7,7 +7,7 @@ namespace Shaarli\Http;
7 7
8require_once 'application/http/UrlUtils.php'; 8require_once 'application/http/UrlUtils.php';
9 9
10class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase 10class GetUrlSchemeTest extends \Shaarli\TestCase
11{ 11{
12 /** 12 /**
13 * Get empty scheme string for empty UrlUtils 13 * Get empty scheme string for empty UrlUtils
diff --git a/tests/http/UrlUtils/UnparseUrlTest.php b/tests/http/UrlUtils/UnparseUrlTest.php
index 040d8c54..5e6246cc 100644
--- a/tests/http/UrlUtils/UnparseUrlTest.php
+++ b/tests/http/UrlUtils/UnparseUrlTest.php
@@ -10,7 +10,7 @@ require_once 'application/http/UrlUtils.php';
10/** 10/**
11 * Unitary tests for unparse_url() 11 * Unitary tests for unparse_url()
12 */ 12 */
13class UnparseUrlTest extends \PHPUnit\Framework\TestCase 13class UnparseUrlTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * Thanks for building nothing 16 * Thanks for building nothing
diff --git a/tests/http/UrlUtils/WhitelistProtocolsTest.php b/tests/http/UrlUtils/WhitelistProtocolsTest.php
index 69512dbd..b8a6baaa 100644
--- a/tests/http/UrlUtils/WhitelistProtocolsTest.php
+++ b/tests/http/UrlUtils/WhitelistProtocolsTest.php
@@ -9,7 +9,7 @@ require_once 'application/http/UrlUtils.php';
9 * 9 *
10 * Test whitelist_protocols() function of UrlUtils. 10 * Test whitelist_protocols() function of UrlUtils.
11 */ 11 */
12class WhitelistProtocolsTest extends \PHPUnit\Framework\TestCase 12class WhitelistProtocolsTest extends \Shaarli\TestCase
13{ 13{
14 /** 14 /**
15 * Test whitelist_protocols() on a note (relative URL). 15 * Test whitelist_protocols() on a note (relative URL).
diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php
index e412b5bc..d84feed1 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 */
15class LanguagesFrTest extends \PHPUnit\Framework\TestCase 15class LanguagesFrTest extends \Shaarli\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/legacy/LegacyControllerTest.php b/tests/legacy/LegacyControllerTest.php
index 4e52f3e1..1a2549a3 100644
--- a/tests/legacy/LegacyControllerTest.php
+++ b/tests/legacy/LegacyControllerTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Legacy; 5namespace Shaarli\Legacy;
6 6
7use PHPUnit\Framework\TestCase;
8use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; 7use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper;
8use Shaarli\TestCase;
9use Slim\Http\Request; 9use Slim\Http\Request;
10use Slim\Http\Response; 10use Slim\Http\Response;
11 11
diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php
index 819bc272..66746dfc 100644
--- a/tests/legacy/LegacyLinkDBTest.php
+++ b/tests/legacy/LegacyLinkDBTest.php
@@ -18,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php';
18/** 18/**
19 * Unitary tests for LegacyLinkDBTest 19 * Unitary tests for LegacyLinkDBTest
20 */ 20 */
21class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase 21class LegacyLinkDBTest extends \Shaarli\TestCase
22{ 22{
23 // datastore to test write operations 23 // datastore to test write operations
24 protected static $testDatastore = 'sandbox/datastore.php'; 24 protected static $testDatastore = 'sandbox/datastore.php';
@@ -258,7 +258,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
258 $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); 258 $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/');
259 259
260 $this->assertNotEquals(false, $link); 260 $this->assertNotEquals(false, $link);
261 $this->assertContains( 261 $this->assertContainsPolyfill(
262 'A free software media publishing platform', 262 'A free software media publishing platform',
263 $link['description'] 263 $link['description']
264 ); 264 );
@@ -471,9 +471,9 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
471 471
472 $res = $linkDB->renameTag('cartoon', 'Taz'); 472 $res = $linkDB->renameTag('cartoon', 'Taz');
473 $this->assertEquals(3, count($res)); 473 $this->assertEquals(3, count($res));
474 $this->assertContains(' Taz ', $linkDB[4]['tags']); 474 $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']);
475 $this->assertContains(' Taz ', $linkDB[1]['tags']); 475 $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']);
476 $this->assertContains(' Taz ', $linkDB[0]['tags']); 476 $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']);
477 } 477 }
478 478
479 /** 479 /**
@@ -513,7 +513,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
513 513
514 $res = $linkDB->renameTag('cartoon', null); 514 $res = $linkDB->renameTag('cartoon', null);
515 $this->assertEquals(3, count($res)); 515 $this->assertEquals(3, count($res));
516 $this->assertNotContains('cartoon', $linkDB[4]['tags']); 516 $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']);
517 } 517 }
518 518
519 /** 519 /**
diff --git a/tests/legacy/LegacyLinkFilterTest.php b/tests/legacy/LegacyLinkFilterTest.php
index 9db921a9..82bc93d8 100644
--- a/tests/legacy/LegacyLinkFilterTest.php
+++ b/tests/legacy/LegacyLinkFilterTest.php
@@ -10,7 +10,7 @@ use Shaarli\Legacy\LegacyLinkFilter;
10/** 10/**
11 * Class LegacyLinkFilterTest. 11 * Class LegacyLinkFilterTest.
12 */ 12 */
13class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase 13class LegacyLinkFilterTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * @var string Test datastore path. 16 * @var string Test datastore path.
diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php
index acfac530..0ddcb4a6 100644
--- a/tests/legacy/LegacyUpdaterTest.php
+++ b/tests/legacy/LegacyUpdaterTest.php
@@ -20,7 +20,7 @@ require_once 'inc/rain.tpl.class.php';
20 * Class UpdaterTest. 20 * Class UpdaterTest.
21 * Runs unit tests against the updater class. 21 * Runs unit tests against the updater class.
22 */ 22 */
23class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase 23class LegacyUpdaterTest extends \Shaarli\TestCase
24{ 24{
25 /** 25 /**
26 * @var string Path to test datastore. 26 * @var string Path to test datastore.
@@ -725,7 +725,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
725 $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode')); 725 $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode'));
726 $this->assertEquals(125, $this->conf->get('thumbnails.width')); 726 $this->assertEquals(125, $this->conf->get('thumbnails.width'));
727 $this->assertEquals(90, $this->conf->get('thumbnails.height')); 727 $this->assertEquals(90, $this->conf->get('thumbnails.height'));
728 $this->assertContains('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); 728 $this->assertContainsPolyfill('You have enabled or changed thumbnails', $_SESSION['warnings'][0]);
729 } 729 }
730 730
731 /** 731 /**
diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php
index a6eacae4..adf62f4f 100644
--- a/tests/netscape/BookmarkExportTest.php
+++ b/tests/netscape/BookmarkExportTest.php
@@ -2,12 +2,12 @@
2 2
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\BookmarkFileService; 5use Shaarli\Bookmark\BookmarkFileService;
7use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
8use Shaarli\Formatter\BookmarkFormatter; 7use Shaarli\Formatter\BookmarkFormatter;
9use Shaarli\Formatter\FormatterFactory; 8use Shaarli\Formatter\FormatterFactory;
10use Shaarli\History; 9use Shaarli\History;
10use Shaarli\TestCase;
11 11
12require_once 'tests/utils/ReferenceLinkDB.php'; 12require_once 'tests/utils/ReferenceLinkDB.php';
13 13
diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php
index 89ae4aa7..c1e49b5f 100644
--- a/tests/netscape/BookmarkImportTest.php
+++ b/tests/netscape/BookmarkImportTest.php
@@ -3,13 +3,13 @@
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use Psr\Http\Message\UploadedFileInterface; 6use Psr\Http\Message\UploadedFileInterface;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\BookmarkFileService; 8use Shaarli\Bookmark\BookmarkFileService;
10use Shaarli\Bookmark\BookmarkFilter; 9use Shaarli\Bookmark\BookmarkFilter;
11use Shaarli\Config\ConfigManager; 10use Shaarli\Config\ConfigManager;
12use Shaarli\History; 11use Shaarli\History;
12use Shaarli\TestCase;
13use Slim\Http\UploadedFile; 13use Slim\Http\UploadedFile;
14 14
15/** 15/**
diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php
index 1f60d289..a3ec9fc9 100644
--- a/tests/plugins/PluginAddlinkTest.php
+++ b/tests/plugins/PluginAddlinkTest.php
@@ -9,7 +9,7 @@ require_once 'plugins/addlink_toolbar/addlink_toolbar.php';
9/** 9/**
10 * Unit test for the Addlink toolbar plugin 10 * Unit test for the Addlink toolbar plugin
11 */ 11 */
12class PluginAddlinkTest extends \PHPUnit\Framework\TestCase 12class PluginAddlinkTest extends \Shaarli\TestCase
13{ 13{
14 /** 14 /**
15 * Reset plugin path. 15 * Reset plugin path.
diff --git a/tests/plugins/PluginArchiveorgTest.php b/tests/plugins/PluginArchiveorgTest.php
index 9c19752c..467dc3d0 100644
--- a/tests/plugins/PluginArchiveorgTest.php
+++ b/tests/plugins/PluginArchiveorgTest.php
@@ -6,8 +6,8 @@ namespace Shaarli\Plugin\Archiveorg;
6 * PluginArchiveorgTest.php 6 * PluginArchiveorgTest.php
7 */ 7 */
8 8
9use PHPUnit\Framework\TestCase;
10use Shaarli\Plugin\PluginManager; 9use Shaarli\Plugin\PluginManager;
10use Shaarli\TestCase;
11 11
12require_once 'plugins/archiveorg/archiveorg.php'; 12require_once 'plugins/archiveorg/archiveorg.php';
13 13
diff --git a/tests/plugins/PluginDefaultColorsTest.php b/tests/plugins/PluginDefaultColorsTest.php
index 240bb4b2..cc844c60 100644
--- a/tests/plugins/PluginDefaultColorsTest.php
+++ b/tests/plugins/PluginDefaultColorsTest.php
@@ -2,10 +2,10 @@
2 2
3namespace Shaarli\Plugin\DefaultColors; 3namespace Shaarli\Plugin\DefaultColors;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\LinkDB; 5use Shaarli\Bookmark\LinkDB;
7use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
8use Shaarli\Plugin\PluginManager; 7use Shaarli\Plugin\PluginManager;
8use Shaarli\TestCase;
9 9
10require_once 'plugins/default_colors/default_colors.php'; 10require_once 'plugins/default_colors/default_colors.php';
11 11
diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php
index 2bbb93d2..16ecf357 100644
--- a/tests/plugins/PluginIssoTest.php
+++ b/tests/plugins/PluginIssoTest.php
@@ -2,10 +2,10 @@
2namespace Shaarli\Plugin\Isso; 2namespace Shaarli\Plugin\Isso;
3 3
4use DateTime; 4use DateTime;
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\Bookmark; 5use Shaarli\Bookmark\Bookmark;
7use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
8use Shaarli\Plugin\PluginManager; 7use Shaarli\Plugin\PluginManager;
8use Shaarli\TestCase;
9 9
10require_once 'plugins/isso/isso.php'; 10require_once 'plugins/isso/isso.php';
11 11
@@ -116,8 +116,8 @@ class PluginIssoTest extends TestCase
116 116
117 $processed = hook_isso_render_linklist($data, $conf); 117 $processed = hook_isso_render_linklist($data, $conf);
118 // link_plugin should be added for the icon 118 // link_plugin should be added for the icon
119 $this->assertContains('<a href="/shaare/'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]); 119 $this->assertContainsPolyfill('<a href="/shaare/'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]);
120 $this->assertContains('<a href="/shaare/'. $short2 .'#isso-thread">', $processed['links'][1]['link_plugin'][0]); 120 $this->assertContainsPolyfill('<a href="/shaare/'. $short2 .'#isso-thread">', $processed['links'][1]['link_plugin'][0]);
121 } 121 }
122 122
123 /** 123 /**
@@ -146,7 +146,7 @@ class PluginIssoTest extends TestCase
146 $processed = hook_isso_render_linklist($data, $conf); 146 $processed = hook_isso_render_linklist($data, $conf);
147 147
148 // link_plugin should be added for the icon 148 // link_plugin should be added for the icon
149 $this->assertContains('<a href="/shaare/'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]); 149 $this->assertContainsPolyfill('<a href="/shaare/'. $short1 .'#isso-thread">', $processed['links'][0]['link_plugin'][0]);
150 } 150 }
151 151
152 /** 152 /**
diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php
index de1a1aec..338d2e35 100644
--- a/tests/plugins/PluginPlayvideosTest.php
+++ b/tests/plugins/PluginPlayvideosTest.php
@@ -14,7 +14,7 @@ require_once 'plugins/playvideos/playvideos.php';
14 * Class PluginPlayvideosTest 14 * Class PluginPlayvideosTest
15 * Unit test for the PlayVideos plugin 15 * Unit test for the PlayVideos plugin
16 */ 16 */
17class PluginPlayvideosTest extends \PHPUnit\Framework\TestCase 17class PluginPlayvideosTest extends \Shaarli\TestCase
18{ 18{
19 /** 19 /**
20 * Reset plugin path 20 * Reset plugin path
diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php
index d30c3703..d3f7b439 100644
--- a/tests/plugins/PluginPubsubhubbubTest.php
+++ b/tests/plugins/PluginPubsubhubbubTest.php
@@ -11,7 +11,7 @@ require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
11 * Class PluginPubsubhubbubTest 11 * Class PluginPubsubhubbubTest
12 * Unit test for the pubsubhubbub plugin 12 * Unit test for the pubsubhubbub plugin
13 */ 13 */
14class PluginPubsubhubbubTest extends \PHPUnit\Framework\TestCase 14class PluginPubsubhubbubTest extends \Shaarli\TestCase
15{ 15{
16 /** 16 /**
17 * @var string Config file path (without extension). 17 * @var string Config file path (without extension).
diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php
index bc6be0eb..1d85fba6 100644
--- a/tests/plugins/PluginQrcodeTest.php
+++ b/tests/plugins/PluginQrcodeTest.php
@@ -14,7 +14,7 @@ require_once 'plugins/qrcode/qrcode.php';
14 * Class PluginQrcodeTest 14 * Class PluginQrcodeTest
15 * Unit test for the QR-Code plugin 15 * Unit test for the QR-Code plugin
16 */ 16 */
17class PluginQrcodeTest extends \PHPUnit\Framework\TestCase 17class PluginQrcodeTest extends \Shaarli\TestCase
18{ 18{
19 /** 19 /**
20 * Reset plugin path 20 * Reset plugin path
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php
index 372929ea..36317215 100644
--- a/tests/plugins/PluginWallabagTest.php
+++ b/tests/plugins/PluginWallabagTest.php
@@ -10,7 +10,7 @@ require_once 'plugins/wallabag/wallabag.php';
10 * Class PluginWallabagTest 10 * Class PluginWallabagTest
11 * Unit test for the Wallabag plugin 11 * Unit test for the Wallabag plugin
12 */ 12 */
13class PluginWallabagTest extends \PHPUnit\Framework\TestCase 13class PluginWallabagTest extends \Shaarli\TestCase
14{ 14{
15 /** 15 /**
16 * Reset plugin path 16 * Reset plugin path
diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php
index 4cb0d4cc..5ef3de1a 100644
--- a/tests/plugins/WallabagInstanceTest.php
+++ b/tests/plugins/WallabagInstanceTest.php
@@ -4,7 +4,7 @@ namespace Shaarli\Plugin\Wallabag;
4/** 4/**
5 * Class WallabagInstanceTest 5 * Class WallabagInstanceTest
6 */ 6 */
7class WallabagInstanceTest extends \PHPUnit\Framework\TestCase 7class WallabagInstanceTest extends \Shaarli\TestCase
8{ 8{
9 /** 9 /**
10 * @var string wallabag url. 10 * @var string wallabag url.
diff --git a/tests/render/PageCacheManagerTest.php b/tests/render/PageCacheManagerTest.php
index 4aa7e179..08d4e5ea 100644
--- a/tests/render/PageCacheManagerTest.php
+++ b/tests/render/PageCacheManagerTest.php
@@ -6,8 +6,8 @@
6 6
7namespace Shaarli\Render; 7namespace Shaarli\Render;
8 8
9use PHPUnit\Framework\TestCase;
10use Shaarli\Security\SessionManager; 9use Shaarli\Security\SessionManager;
10use Shaarli\TestCase;
11 11
12/** 12/**
13 * Unitary tests for cached pages 13 * Unitary tests for cached pages
diff --git a/tests/render/ThemeUtilsTest.php b/tests/render/ThemeUtilsTest.php
index 58e3426b..7d841e4d 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 */
10class ThemeUtilsTest extends \PHPUnit\Framework\TestCase 10class ThemeUtilsTest extends \Shaarli\TestCase
11{ 11{
12 /** 12 /**
13 * Test getThemes() with existing theme directories. 13 * Test getThemes() with existing theme directories.
diff --git a/tests/security/BanManagerTest.php b/tests/security/BanManagerTest.php
index 2fef82f5..698d3d10 100644
--- a/tests/security/BanManagerTest.php
+++ b/tests/security/BanManagerTest.php
@@ -3,8 +3,8 @@
3 3
4namespace Shaarli\Security; 4namespace Shaarli\Security;
5 5
6use PHPUnit\Framework\TestCase;
7use Shaarli\FileUtils; 6use Shaarli\FileUtils;
7use Shaarli\TestCase;
8 8
9/** 9/**
10 * Test coverage for BanManager 10 * Test coverage for BanManager
diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php
index cc9aa647..d302983d 100644
--- a/tests/security/LoginManagerTest.php
+++ b/tests/security/LoginManagerTest.php
@@ -2,7 +2,7 @@
2 2
3namespace Shaarli\Security; 3namespace Shaarli\Security;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6 6
7/** 7/**
8 * Test coverage for LoginManager 8 * Test coverage for LoginManager
diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php
index 27e3b1a9..3f9c3ef5 100644
--- a/tests/security/SessionManagerTest.php
+++ b/tests/security/SessionManagerTest.php
@@ -2,7 +2,7 @@
2 2
3namespace Shaarli\Security; 3namespace Shaarli\Security;
4 4
5use PHPUnit\Framework\TestCase; 5use Shaarli\TestCase;
6 6
7/** 7/**
8 * Test coverage for SessionManager 8 * Test coverage for SessionManager
diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php
index 5cfcd5db..73029e07 100644
--- a/tests/updater/UpdaterTest.php
+++ b/tests/updater/UpdaterTest.php
@@ -2,11 +2,11 @@
2namespace Shaarli\Updater; 2namespace Shaarli\Updater;
3 3
4use Exception; 4use Exception;
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\BookmarkFileService; 5use Shaarli\Bookmark\BookmarkFileService;
7use Shaarli\Bookmark\BookmarkServiceInterface; 6use Shaarli\Bookmark\BookmarkServiceInterface;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\History; 8use Shaarli\History;
9use Shaarli\TestCase;
10 10
11 11
12/** 12/**