aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/visitor
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-29 14:41:40 +0200
committerArthurHoaro <arthur@hoa.ro>2020-09-29 18:57:20 +0200
commita5a9cf23acd1248585173aa32757d9720b5f2d62 (patch)
tree5b443e09fc0f84db0cb478cda0c88c10346b0843 /tests/front/controller/visitor
parent2b7a7bc928fb7fc171138e248d3aa1d86d5b62f9 (diff)
downloadShaarli-a5a9cf23acd1248585173aa32757d9720b5f2d62.tar.gz
Shaarli-a5a9cf23acd1248585173aa32757d9720b5f2d62.tar.zst
Shaarli-a5a9cf23acd1248585173aa32757d9720b5f2d62.zip
Compatibility with PHPUnit 9
Diffstat (limited to 'tests/front/controller/visitor')
-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
14 files changed, 110 insertions, 89 deletions
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