diff options
Diffstat (limited to 'tests/container/ContainerBuilderTest.php')
-rw-r--r-- | tests/container/ContainerBuilderTest.php | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/container/ContainerBuilderTest.php b/tests/container/ContainerBuilderTest.php index 9b97ed6d..fa77bf31 100644 --- a/tests/container/ContainerBuilderTest.php +++ b/tests/container/ContainerBuilderTest.php | |||
@@ -7,10 +7,19 @@ namespace Shaarli\Container; | |||
7 | use PHPUnit\Framework\TestCase; | 7 | use PHPUnit\Framework\TestCase; |
8 | use Shaarli\Bookmark\BookmarkServiceInterface; | 8 | use Shaarli\Bookmark\BookmarkServiceInterface; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\Feed\FeedBuilder; | ||
11 | use Shaarli\Formatter\FormatterFactory; | ||
10 | use Shaarli\History; | 12 | use Shaarli\History; |
13 | use Shaarli\Http\HttpAccess; | ||
14 | use Shaarli\Netscape\NetscapeBookmarkUtils; | ||
15 | use Shaarli\Plugin\PluginManager; | ||
11 | use Shaarli\Render\PageBuilder; | 16 | use Shaarli\Render\PageBuilder; |
17 | use Shaarli\Render\PageCacheManager; | ||
18 | use Shaarli\Security\CookieManager; | ||
12 | use Shaarli\Security\LoginManager; | 19 | use Shaarli\Security\LoginManager; |
13 | use Shaarli\Security\SessionManager; | 20 | use Shaarli\Security\SessionManager; |
21 | use Shaarli\Thumbnailer; | ||
22 | use Shaarli\Updater\Updater; | ||
14 | 23 | ||
15 | class ContainerBuilderTest extends TestCase | 24 | class ContainerBuilderTest extends TestCase |
16 | { | 25 | { |
@@ -26,13 +35,24 @@ class ContainerBuilderTest extends TestCase | |||
26 | /** @var ContainerBuilder */ | 35 | /** @var ContainerBuilder */ |
27 | protected $containerBuilder; | 36 | protected $containerBuilder; |
28 | 37 | ||
38 | /** @var CookieManager */ | ||
39 | protected $cookieManager; | ||
40 | |||
29 | public function setUp(): void | 41 | public function setUp(): void |
30 | { | 42 | { |
31 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | 43 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
32 | $this->sessionManager = $this->createMock(SessionManager::class); | 44 | $this->sessionManager = $this->createMock(SessionManager::class); |
45 | $this->cookieManager = $this->createMock(CookieManager::class); | ||
46 | |||
33 | $this->loginManager = $this->createMock(LoginManager::class); | 47 | $this->loginManager = $this->createMock(LoginManager::class); |
48 | $this->loginManager->method('isLoggedIn')->willReturn(true); | ||
34 | 49 | ||
35 | $this->containerBuilder = new ContainerBuilder($this->conf, $this->sessionManager, $this->loginManager); | 50 | $this->containerBuilder = new ContainerBuilder( |
51 | $this->conf, | ||
52 | $this->sessionManager, | ||
53 | $this->cookieManager, | ||
54 | $this->loginManager | ||
55 | ); | ||
36 | } | 56 | } |
37 | 57 | ||
38 | public function testBuildContainer(): void | 58 | public function testBuildContainer(): void |
@@ -41,9 +61,21 @@ class ContainerBuilderTest extends TestCase | |||
41 | 61 | ||
42 | static::assertInstanceOf(ConfigManager::class, $container->conf); | 62 | static::assertInstanceOf(ConfigManager::class, $container->conf); |
43 | static::assertInstanceOf(SessionManager::class, $container->sessionManager); | 63 | static::assertInstanceOf(SessionManager::class, $container->sessionManager); |
64 | static::assertInstanceOf(CookieManager::class, $container->cookieManager); | ||
44 | static::assertInstanceOf(LoginManager::class, $container->loginManager); | 65 | static::assertInstanceOf(LoginManager::class, $container->loginManager); |
45 | static::assertInstanceOf(History::class, $container->history); | 66 | static::assertInstanceOf(History::class, $container->history); |
46 | static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); | 67 | static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); |
47 | static::assertInstanceOf(PageBuilder::class, $container->pageBuilder); | 68 | 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); | ||
72 | static::assertInstanceOf(FeedBuilder::class, $container->feedBuilder); | ||
73 | 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); | ||
77 | |||
78 | // Set by the middleware | ||
79 | static::assertNull($container->basePath); | ||
48 | } | 80 | } |
49 | } | 81 | } |