aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-08-27 12:04:36 +0200
committerArthurHoaro <arthur@hoa.ro>2020-08-27 12:04:36 +0200
commit7e3dc0ba98bf019c2804e5c74fb6061b16fb712f (patch)
treef0a333e9e009d78d59c1e4823f766625bc2bb255
parentaf41d5ab5d2bd3ba64d052c997bc6afa6966a63c (diff)
downloadShaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.tar.gz
Shaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.tar.zst
Shaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.zip
Better handling of plugin incompatibility
If a PHP is raised while executing plugin hook, Shaarli will display an error instead of rendering the error page (or just ending in fatal error for default hooks). Also added phpErrorHandler which is handled differently that regular errorHandler by Slim.:
-rw-r--r--application/container/ContainerBuilder.php3
-rw-r--r--application/container/ShaarliContainer.php4
-rw-r--r--application/front/controller/visitor/ShaarliVisitorController.php3
-rw-r--r--application/plugin/PluginManager.php7
-rw-r--r--inc/languages/fr/LC_MESSAGES/shaarli.po66
-rw-r--r--tests/PluginManagerTest.php29
-rw-r--r--tests/container/ContainerBuilderTest.php23
-rw-r--r--tests/plugins/test/test.php5
8 files changed, 90 insertions, 50 deletions
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php
index 4a1a6ea7..58067c99 100644
--- a/application/container/ContainerBuilder.php
+++ b/application/container/ContainerBuilder.php
@@ -152,6 +152,9 @@ class ContainerBuilder
152 $container['errorHandler'] = function (ShaarliContainer $container): ErrorController { 152 $container['errorHandler'] = function (ShaarliContainer $container): ErrorController {
153 return new ErrorController($container); 153 return new ErrorController($container);
154 }; 154 };
155 $container['phpErrorHandler'] = function (ShaarliContainer $container): ErrorController {
156 return new ErrorController($container);
157 };
155 158
156 return $container; 159 return $container;
157 } 160 }
diff --git a/application/container/ShaarliContainer.php b/application/container/ShaarliContainer.php
index c4fe753e..9a9a974a 100644
--- a/application/container/ShaarliContainer.php
+++ b/application/container/ShaarliContainer.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
4 4
5namespace Shaarli\Container; 5namespace Shaarli\Container;
6 6
7use http\Cookie;
8use Shaarli\Bookmark\BookmarkServiceInterface; 7use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 8use Shaarli\Config\ConfigManager;
10use Shaarli\Feed\FeedBuilder; 9use Shaarli\Feed\FeedBuilder;
@@ -30,7 +29,7 @@ use Slim\Container;
30 * @property CookieManager $cookieManager 29 * @property CookieManager $cookieManager
31 * @property ConfigManager $conf 30 * @property ConfigManager $conf
32 * @property mixed[] $environment $_SERVER automatically injected by Slim 31 * @property mixed[] $environment $_SERVER automatically injected by Slim
33 * @property callable $errorHandler Overrides default Slim error display 32 * @property callable $errorHandler Overrides default Slim exception display
34 * @property FeedBuilder $feedBuilder 33 * @property FeedBuilder $feedBuilder
35 * @property FormatterFactory $formatterFactory 34 * @property FormatterFactory $formatterFactory
36 * @property History $history 35 * @property History $history
@@ -39,6 +38,7 @@ use Slim\Container;
39 * @property NetscapeBookmarkUtils $netscapeBookmarkUtils 38 * @property NetscapeBookmarkUtils $netscapeBookmarkUtils
40 * @property PageBuilder $pageBuilder 39 * @property PageBuilder $pageBuilder
41 * @property PageCacheManager $pageCacheManager 40 * @property PageCacheManager $pageCacheManager
41 * @property callable $phpErrorHandler Overrides default Slim PHP error display
42 * @property PluginManager $pluginManager 42 * @property PluginManager $pluginManager
43 * @property SessionManager $sessionManager 43 * @property SessionManager $sessionManager
44 * @property Thumbnailer $thumbnailer 44 * @property Thumbnailer $thumbnailer
diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php
index 47057d97..f17c8ed3 100644
--- a/application/front/controller/visitor/ShaarliVisitorController.php
+++ b/application/front/controller/visitor/ShaarliVisitorController.php
@@ -58,10 +58,11 @@ abstract class ShaarliVisitorController
58 { 58 {
59 $this->assignView('linkcount', $this->container->bookmarkService->count(BookmarkFilter::$ALL)); 59 $this->assignView('linkcount', $this->container->bookmarkService->count(BookmarkFilter::$ALL));
60 $this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE)); 60 $this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE));
61 $this->assignView('plugin_errors', $this->container->pluginManager->getErrors());
62 61
63 $this->executeDefaultHooks($template); 62 $this->executeDefaultHooks($template);
64 63
64 $this->assignView('plugin_errors', $this->container->pluginManager->getErrors());
65
65 return $this->container->pageBuilder->render($template, $this->container->basePath); 66 return $this->container->pageBuilder->render($template, $this->container->basePath);
66 } 67 }
67 68
diff --git a/application/plugin/PluginManager.php b/application/plugin/PluginManager.php
index b3e8b2f8..2d93cb3a 100644
--- a/application/plugin/PluginManager.php
+++ b/application/plugin/PluginManager.php
@@ -116,7 +116,12 @@ class PluginManager
116 $hookFunction = $this->buildHookName($hook, $plugin); 116 $hookFunction = $this->buildHookName($hook, $plugin);
117 117
118 if (function_exists($hookFunction)) { 118 if (function_exists($hookFunction)) {
119 $data = call_user_func($hookFunction, $data, $this->conf); 119 try {
120 $data = call_user_func($hookFunction, $data, $this->conf);
121 } catch (\Throwable $e) {
122 $error = $plugin . t(' [plugin incompatibility]: ') . $e->getMessage();
123 $this->errors = array_unique(array_merge($this->errors, [$error]));
124 }
120 } 125 }
121 } 126 }
122 } 127 }
diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po
index fda0e62f..fbb2fe64 100644
--- a/inc/languages/fr/LC_MESSAGES/shaarli.po
+++ b/inc/languages/fr/LC_MESSAGES/shaarli.po
@@ -1,15 +1,15 @@
1msgid "" 1msgid ""
2msgstr "" 2msgstr ""
3"Project-Id-Version: Shaarli\n" 3"Project-Id-Version: Shaarli\n"
4"POT-Creation-Date: 2020-07-23 17:11+0200\n" 4"POT-Creation-Date: 2020-08-27 12:01+0200\n"
5"PO-Revision-Date: 2020-07-23 17:12+0200\n" 5"PO-Revision-Date: 2020-08-27 12:02+0200\n"
6"Last-Translator: \n" 6"Last-Translator: \n"
7"Language-Team: Shaarli\n" 7"Language-Team: Shaarli\n"
8"Language: fr_FR\n" 8"Language: fr_FR\n"
9"MIME-Version: 1.0\n" 9"MIME-Version: 1.0\n"
10"Content-Type: text/plain; charset=UTF-8\n" 10"Content-Type: text/plain; charset=UTF-8\n"
11"Content-Transfer-Encoding: 8bit\n" 11"Content-Transfer-Encoding: 8bit\n"
12"X-Generator: Poedit 2.0.6\n" 12"X-Generator: Poedit 2.3\n"
13"X-Poedit-Basepath: ../../../..\n" 13"X-Poedit-Basepath: ../../../..\n"
14"Plural-Forms: nplurals=2; plural=(n > 1);\n" 14"Plural-Forms: nplurals=2; plural=(n > 1);\n"
15"X-Poedit-SourceCharset: UTF-8\n" 15"X-Poedit-SourceCharset: UTF-8\n"
@@ -103,36 +103,36 @@ msgstr "Mo"
103msgid "GiB" 103msgid "GiB"
104msgstr "Go" 104msgstr "Go"
105 105
106#: application/bookmark/BookmarkFileService.php:161 106#: application/bookmark/BookmarkFileService.php:165
107#: application/bookmark/BookmarkFileService.php:186 107#: application/bookmark/BookmarkFileService.php:190
108#: application/bookmark/BookmarkFileService.php:211 108#: application/bookmark/BookmarkFileService.php:215
109#: application/bookmark/BookmarkFileService.php:228 109#: application/bookmark/BookmarkFileService.php:232
110msgid "You're not authorized to alter the datastore" 110msgid "You're not authorized to alter the datastore"
111msgstr "Vous n'êtes pas autorisé à modifier les données" 111msgstr "Vous n'êtes pas autorisé à modifier les données"
112 112
113#: application/bookmark/BookmarkFileService.php:164 113#: application/bookmark/BookmarkFileService.php:168
114#: application/bookmark/BookmarkFileService.php:189 114#: application/bookmark/BookmarkFileService.php:193
115#: application/bookmark/BookmarkFileService.php:231 115#: application/bookmark/BookmarkFileService.php:235
116msgid "Provided data is invalid" 116msgid "Provided data is invalid"
117msgstr "Les informations fournies ne sont pas valides" 117msgstr "Les informations fournies ne sont pas valides"
118 118
119#: application/bookmark/BookmarkFileService.php:192 119#: application/bookmark/BookmarkFileService.php:196
120msgid "This bookmarks already exists" 120msgid "This bookmarks already exists"
121msgstr "Ce marque-page existe déjà." 121msgstr "Ce marque-page existe déjà."
122 122
123#: application/bookmark/BookmarkInitializer.php:40 123#: application/bookmark/BookmarkInitializer.php:37
124#: application/legacy/LegacyLinkDB.php:266 124#: application/legacy/LegacyLinkDB.php:266
125msgid "My secret stuff... - Pastebin.com" 125msgid "My secret stuff... - Pastebin.com"
126msgstr "Mes trucs secrets... - Pastebin.com" 126msgstr "Mes trucs secrets... - Pastebin.com"
127 127
128#: application/bookmark/BookmarkInitializer.php:42 128#: application/bookmark/BookmarkInitializer.php:39
129#: application/legacy/LegacyLinkDB.php:268 129#: application/legacy/LegacyLinkDB.php:268
130msgid "Shhhh! I'm a private link only YOU can see. You can delete me too." 130msgid "Shhhh! I'm a private link only YOU can see. You can delete me too."
131msgstr "" 131msgstr ""
132"Pssst ! Je suis un lien privé que VOUS êtes le seul à voir. Vous pouvez me " 132"Pssst ! Je suis un lien privé que VOUS êtes le seul à voir. Vous pouvez me "
133"supprimer aussi." 133"supprimer aussi."
134 134
135#: application/bookmark/BookmarkInitializer.php:48 135#: application/bookmark/BookmarkInitializer.php:45
136#: application/legacy/LegacyLinkDB.php:246 136#: application/legacy/LegacyLinkDB.php:246
137#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:15 137#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:15
138#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:49 138#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:49
@@ -144,7 +144,7 @@ msgstr ""
144"Le gestionnaire de marque-pages personnel, minimaliste, et sans base de " 144"Le gestionnaire de marque-pages personnel, minimaliste, et sans base de "
145"données" 145"données"
146 146
147#: application/bookmark/BookmarkInitializer.php:51 147#: application/bookmark/BookmarkInitializer.php:48
148#: application/legacy/LegacyLinkDB.php:249 148#: application/legacy/LegacyLinkDB.php:249
149msgid "" 149msgid ""
150"Welcome to Shaarli! This is your first public bookmark. To edit or delete " 150"Welcome to Shaarli! This is your first public bookmark. To edit or delete "
@@ -210,10 +210,6 @@ msgstr "Liens directs"
210msgid "Permalink" 210msgid "Permalink"
211msgstr "Permalien" 211msgstr "Permalien"
212 212
213#: application/front/ShaarliMiddleware.php:78
214msgid "An unexpected error occurred."
215msgstr "Une erreur inattendue s'est produite."
216
217#: application/front/controller/admin/ConfigureController.php:54 213#: application/front/controller/admin/ConfigureController.php:54
218#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 214#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
219msgid "Configure" 215msgid "Configure"
@@ -230,7 +226,7 @@ msgid "Please synchronize them."
230msgstr "Merci de les synchroniser." 226msgstr "Merci de les synchroniser."
231 227
232#: application/front/controller/admin/ConfigureController.php:113 228#: application/front/controller/admin/ConfigureController.php:113
233#: application/front/controller/visitor/InstallController.php:137 229#: application/front/controller/visitor/InstallController.php:136
234msgid "Error while writing config file after configuration update." 230msgid "Error while writing config file after configuration update."
235msgstr "" 231msgstr ""
236"Une erreur s'est produite lors de la sauvegarde du fichier de configuration." 232"Une erreur s'est produite lors de la sauvegarde du fichier de configuration."
@@ -373,7 +369,7 @@ msgstr "Mise à jour des miniatures"
373msgid "Tools" 369msgid "Tools"
374msgstr "Outils" 370msgstr "Outils"
375 371
376#: application/front/controller/visitor/BookmarkListController.php:114 372#: application/front/controller/visitor/BookmarkListController.php:115
377msgid "Search: " 373msgid "Search: "
378msgstr "Recherche : " 374msgstr "Recherche : "
379 375
@@ -385,13 +381,17 @@ msgstr "Aujourd'hui"
385msgid "Yesterday" 381msgid "Yesterday"
386msgstr "Hier" 382msgstr "Hier"
387 383
388#: application/front/controller/visitor/DailyController.php:86 384#: application/front/controller/visitor/DailyController.php:85
389#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48 385#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48
390#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:48 386#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:48
391msgid "Daily" 387msgid "Daily"
392msgstr "Quotidien" 388msgstr "Quotidien"
393 389
394#: application/front/controller/visitor/InstallController.php:74 390#: application/front/controller/visitor/ErrorController.php:36
391msgid "An unexpected error occurred."
392msgstr "Une erreur inattendue s'est produite."
393
394#: application/front/controller/visitor/InstallController.php:73
395#, php-format 395#, php-format
396msgid "" 396msgid ""
397"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the " 397"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
@@ -410,14 +410,14 @@ msgstr ""
410"des cookies. Nous vous recommandons d'accéder à votre serveur depuis son " 410"des cookies. Nous vous recommandons d'accéder à votre serveur depuis son "
411"adresse IP ou un <em>Fully Qualified Domain Name</em>.<br>" 411"adresse IP ou un <em>Fully Qualified Domain Name</em>.<br>"
412 412
413#: application/front/controller/visitor/InstallController.php:149 413#: application/front/controller/visitor/InstallController.php:144
414msgid "" 414msgid ""
415"Shaarli is now configured. Please login and start shaaring your bookmarks!" 415"Shaarli is now configured. Please login and start shaaring your bookmarks!"
416msgstr "" 416msgstr ""
417"Shaarli est maintenant configuré. Vous pouvez vous connecter et commencez à " 417"Shaarli est maintenant configuré. Vous pouvez vous connecter et commencez à "
418"shaare vos liens !" 418"shaare vos liens !"
419 419
420#: application/front/controller/visitor/InstallController.php:163 420#: application/front/controller/visitor/InstallController.php:158
421msgid "Insufficient permissions:" 421msgid "Insufficient permissions:"
422msgstr "Permissions insuffisantes :" 422msgstr "Permissions insuffisantes :"
423 423
@@ -441,7 +441,7 @@ msgstr "Nom d'utilisateur ou mot de passe incorrect(s)."
441msgid "Picture wall" 441msgid "Picture wall"
442msgstr "Mur d'images" 442msgstr "Mur d'images"
443 443
444#: application/front/controller/visitor/TagCloudController.php:82 444#: application/front/controller/visitor/TagCloudController.php:80
445#, fuzzy 445#, fuzzy
446#| msgid "Tag list" 446#| msgid "Tag list"
447msgid "Tag " 447msgid "Tag "
@@ -519,6 +519,10 @@ msgstr ""
519"a été importé avec succès en %d secondes : %d liens importés, %d liens " 519"a été importé avec succès en %d secondes : %d liens importés, %d liens "
520"écrasés, %d liens ignorés." 520"écrasés, %d liens ignorés."
521 521
522#: application/plugin/PluginManager.php:122
523msgid " [plugin incompatibility]: "
524msgstr " [incompatibilité de l'extension] : "
525
522#: application/plugin/exception/PluginFileNotFoundException.php:21 526#: application/plugin/exception/PluginFileNotFoundException.php:21
523#, php-format 527#, php-format
524msgid "Plugin \"%s\" files not found." 528msgid "Plugin \"%s\" files not found."
@@ -550,11 +554,11 @@ msgstr "Shaare"
550msgid "Adds the addlink input on the linklist page." 554msgid "Adds the addlink input on the linklist page."
551msgstr "Ajoute le formulaire d'ajout de liens sur la page principale." 555msgstr "Ajoute le formulaire d'ajout de liens sur la page principale."
552 556
553#: plugins/archiveorg/archiveorg.php:25 557#: plugins/archiveorg/archiveorg.php:26
554msgid "View on archive.org" 558msgid "View on archive.org"
555msgstr "Voir sur archive.org" 559msgstr "Voir sur archive.org"
556 560
557#: plugins/archiveorg/archiveorg.php:38 561#: plugins/archiveorg/archiveorg.php:39
558msgid "For each link, add an Archive.org icon." 562msgid "For each link, add an Archive.org icon."
559msgstr "Pour chaque lien, ajoute une icône pour Archive.org." 563msgstr "Pour chaque lien, ajoute une icône pour Archive.org."
560 564
@@ -674,7 +678,7 @@ msgstr "Mauvaise réponse du hub %s"
674msgid "Enable PubSubHubbub feed publishing." 678msgid "Enable PubSubHubbub feed publishing."
675msgstr "Active la publication de flux vers PubSubHubbub." 679msgstr "Active la publication de flux vers PubSubHubbub."
676 680
677#: plugins/qrcode/qrcode.php:72 plugins/wallabag/wallabag.php:68 681#: plugins/qrcode/qrcode.php:73 plugins/wallabag/wallabag.php:70
678msgid "For each link, add a QRCode icon." 682msgid "For each link, add a QRCode icon."
679msgstr "Pour chaque lien, ajouter une icône de QRCode." 683msgstr "Pour chaque lien, ajouter une icône de QRCode."
680 684
@@ -690,11 +694,11 @@ msgstr ""
690msgid "Save to wallabag" 694msgid "Save to wallabag"
691msgstr "Sauvegarder dans Wallabag" 695msgstr "Sauvegarder dans Wallabag"
692 696
693#: plugins/wallabag/wallabag.php:69 697#: plugins/wallabag/wallabag.php:71
694msgid "Wallabag API URL" 698msgid "Wallabag API URL"
695msgstr "URL de l'API Wallabag" 699msgstr "URL de l'API Wallabag"
696 700
697#: plugins/wallabag/wallabag.php:70 701#: plugins/wallabag/wallabag.php:72
698msgid "Wallabag API version (1 or 2)" 702msgid "Wallabag API version (1 or 2)"
699msgstr "Version de l'API Wallabag (1 ou 2)" 703msgstr "Version de l'API Wallabag (1 ou 2)"
700 704
diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php
index 195d959c..a5d5dbe9 100644
--- a/tests/PluginManagerTest.php
+++ b/tests/PluginManagerTest.php
@@ -25,7 +25,7 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
25 */ 25 */
26 protected $pluginManager; 26 protected $pluginManager;
27 27
28 public function setUp() 28 public function setUp(): void
29 { 29 {
30 $conf = new ConfigManager(''); 30 $conf = new ConfigManager('');
31 $this->pluginManager = new PluginManager($conf); 31 $this->pluginManager = new PluginManager($conf);
@@ -33,10 +33,8 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
33 33
34 /** 34 /**
35 * Test plugin loading and hook execution. 35 * Test plugin loading and hook execution.
36 *
37 * @return void
38 */ 36 */
39 public function testPlugin() 37 public function testPlugin(): void
40 { 38 {
41 PluginManager::$PLUGINS_PATH = self::$pluginPath; 39 PluginManager::$PLUGINS_PATH = self::$pluginPath;
42 $this->pluginManager->load(array(self::$pluginName)); 40 $this->pluginManager->load(array(self::$pluginName));
@@ -57,9 +55,28 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
57 } 55 }
58 56
59 /** 57 /**
58 * Test plugin loading and hook execution with an error: raise an incompatibility error.
59 */
60 public function testPluginWithPhpError(): void
61 {
62 PluginManager::$PLUGINS_PATH = self::$pluginPath;
63 $this->pluginManager->load(array(self::$pluginName));
64
65 $this->assertTrue(function_exists('hook_test_error'));
66
67 $data = [];
68 $this->pluginManager->executeHooks('error', $data);
69
70 $this->assertSame(
71 'test [plugin incompatibility]: Class \'Unknown\' not found',
72 $this->pluginManager->getErrors()[0]
73 );
74 }
75
76 /**
60 * Test missing plugin loading. 77 * Test missing plugin loading.
61 */ 78 */
62 public function testPluginNotFound() 79 public function testPluginNotFound(): void
63 { 80 {
64 $this->pluginManager->load(array()); 81 $this->pluginManager->load(array());
65 $this->pluginManager->load(array('nope', 'renope')); 82 $this->pluginManager->load(array('nope', 'renope'));
@@ -69,7 +86,7 @@ class PluginManagerTest extends \PHPUnit\Framework\TestCase
69 /** 86 /**
70 * Test plugin metadata loading. 87 * Test plugin metadata loading.
71 */ 88 */
72 public function testGetPluginsMeta() 89 public function testGetPluginsMeta(): void
73 { 90 {
74 PluginManager::$PLUGINS_PATH = self::$pluginPath; 91 PluginManager::$PLUGINS_PATH = self::$pluginPath;
75 $this->pluginManager->load(array(self::$pluginName)); 92 $this->pluginManager->load(array(self::$pluginName));
diff --git a/tests/container/ContainerBuilderTest.php b/tests/container/ContainerBuilderTest.php
index fa77bf31..c08010ae 100644
--- a/tests/container/ContainerBuilderTest.php
+++ b/tests/container/ContainerBuilderTest.php
@@ -9,6 +9,7 @@ use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
10use Shaarli\Feed\FeedBuilder; 10use Shaarli\Feed\FeedBuilder;
11use Shaarli\Formatter\FormatterFactory; 11use Shaarli\Formatter\FormatterFactory;
12use Shaarli\Front\Controller\Visitor\ErrorController;
12use Shaarli\History; 13use Shaarli\History;
13use Shaarli\Http\HttpAccess; 14use Shaarli\Http\HttpAccess;
14use Shaarli\Netscape\NetscapeBookmarkUtils; 15use Shaarli\Netscape\NetscapeBookmarkUtils;
@@ -20,6 +21,7 @@ use Shaarli\Security\LoginManager;
20use Shaarli\Security\SessionManager; 21use Shaarli\Security\SessionManager;
21use Shaarli\Thumbnailer; 22use Shaarli\Thumbnailer;
22use Shaarli\Updater\Updater; 23use Shaarli\Updater\Updater;
24use Slim\Http\Environment;
23 25
24class ContainerBuilderTest extends TestCase 26class ContainerBuilderTest extends TestCase
25{ 27{
@@ -59,20 +61,23 @@ class ContainerBuilderTest extends TestCase
59 { 61 {
60 $container = $this->containerBuilder->build(); 62 $container = $this->containerBuilder->build();
61 63
62 static::assertInstanceOf(ConfigManager::class, $container->conf); 64 static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService);
63 static::assertInstanceOf(SessionManager::class, $container->sessionManager);
64 static::assertInstanceOf(CookieManager::class, $container->cookieManager); 65 static::assertInstanceOf(CookieManager::class, $container->cookieManager);
65 static::assertInstanceOf(LoginManager::class, $container->loginManager); 66 static::assertInstanceOf(ConfigManager::class, $container->conf);
67 static::assertInstanceOf(ErrorController::class, $container->errorHandler);
68 static::assertInstanceOf(Environment::class, $container->environment);
69 static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder);
70 static::assertInstanceOf(FormatterFactory::class, $container->formatterFactory);
66 static::assertInstanceOf(History::class, $container->history); 71 static::assertInstanceOf(History::class, $container->history);
67 static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); 72 static::assertInstanceOf(HttpAccess::class, $container->httpAccess);
73 static::assertInstanceOf(LoginManager::class, $container->loginManager);
74 static::assertInstanceOf(NetscapeBookmarkUtils::class, $container->netscapeBookmarkUtils);
68 static::assertInstanceOf(PageBuilder::class, $container->pageBuilder); 75 static::assertInstanceOf(PageBuilder::class, $container->pageBuilder);
69 static::assertInstanceOf(PluginManager::class, $container->pluginManager);
70 static::assertInstanceOf(FormatterFactory::class, $container->formatterFactory);
71 static::assertInstanceOf(PageCacheManager::class, $container->pageCacheManager); 76 static::assertInstanceOf(PageCacheManager::class, $container->pageCacheManager);
72 static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder); 77 static::assertInstanceOf(ErrorController::class, $container->phpErrorHandler);
78 static::assertInstanceOf(PluginManager::class, $container->pluginManager);
79 static::assertInstanceOf(SessionManager::class, $container->sessionManager);
73 static::assertInstanceOf(Thumbnailer::class, $container->thumbnailer); 80 static::assertInstanceOf(Thumbnailer::class, $container->thumbnailer);
74 static::assertInstanceOf(HttpAccess::class, $container->httpAccess);
75 static::assertInstanceOf(NetscapeBookmarkUtils::class, $container->netscapeBookmarkUtils);
76 static::assertInstanceOf(Updater::class, $container->updater); 81 static::assertInstanceOf(Updater::class, $container->updater);
77 82
78 // Set by the middleware 83 // Set by the middleware
diff --git a/tests/plugins/test/test.php b/tests/plugins/test/test.php
index 2aaf5122..ae5032dd 100644
--- a/tests/plugins/test/test.php
+++ b/tests/plugins/test/test.php
@@ -19,3 +19,8 @@ function hook_test_random($data)
19 19
20 return $data; 20 return $data;
21} 21}
22
23function hook_test_error()
24{
25 new Unknown();
26}