From 7e3dc0ba98bf019c2804e5c74fb6061b16fb712f Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 27 Aug 2020 12:04:36 +0200 Subject: 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.: --- tests/container/ContainerBuilderTest.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'tests/container/ContainerBuilderTest.php') 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; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; use Shaarli\Formatter\FormatterFactory; +use Shaarli\Front\Controller\Visitor\ErrorController; use Shaarli\History; use Shaarli\Http\HttpAccess; use Shaarli\Netscape\NetscapeBookmarkUtils; @@ -20,6 +21,7 @@ use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; use Shaarli\Thumbnailer; use Shaarli\Updater\Updater; +use Slim\Http\Environment; class ContainerBuilderTest extends TestCase { @@ -59,20 +61,23 @@ class ContainerBuilderTest extends TestCase { $container = $this->containerBuilder->build(); - static::assertInstanceOf(ConfigManager::class, $container->conf); - static::assertInstanceOf(SessionManager::class, $container->sessionManager); + static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); static::assertInstanceOf(CookieManager::class, $container->cookieManager); - static::assertInstanceOf(LoginManager::class, $container->loginManager); + static::assertInstanceOf(ConfigManager::class, $container->conf); + static::assertInstanceOf(ErrorController::class, $container->errorHandler); + static::assertInstanceOf(Environment::class, $container->environment); + static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder); + static::assertInstanceOf(FormatterFactory::class, $container->formatterFactory); static::assertInstanceOf(History::class, $container->history); - static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); + static::assertInstanceOf(HttpAccess::class, $container->httpAccess); + static::assertInstanceOf(LoginManager::class, $container->loginManager); + static::assertInstanceOf(NetscapeBookmarkUtils::class, $container->netscapeBookmarkUtils); static::assertInstanceOf(PageBuilder::class, $container->pageBuilder); - static::assertInstanceOf(PluginManager::class, $container->pluginManager); - static::assertInstanceOf(FormatterFactory::class, $container->formatterFactory); static::assertInstanceOf(PageCacheManager::class, $container->pageCacheManager); - static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder); + static::assertInstanceOf(ErrorController::class, $container->phpErrorHandler); + static::assertInstanceOf(PluginManager::class, $container->pluginManager); + static::assertInstanceOf(SessionManager::class, $container->sessionManager); static::assertInstanceOf(Thumbnailer::class, $container->thumbnailer); - static::assertInstanceOf(HttpAccess::class, $container->httpAccess); - static::assertInstanceOf(NetscapeBookmarkUtils::class, $container->netscapeBookmarkUtils); static::assertInstanceOf(Updater::class, $container->updater); // Set by the middleware -- cgit v1.2.3