aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/container/ContainerBuilderTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-08-27 10:27:34 +0200
committerGitHub <noreply@github.com>2020-08-27 10:27:34 +0200
commitaf41d5ab5d2bd3ba64d052c997bc6afa6966a63c (patch)
tree8fad2829c55f94022e359fa8914e11f80a2afc2a /tests/container/ContainerBuilderTest.php
parentb8e3630f2ecd142d397b1b062a346a667bb78595 (diff)
parent0c6fdbe12bbbb336348666b14b82096f24d5858b (diff)
downloadShaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.tar.gz
Shaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.tar.zst
Shaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.zip
Merge pull request #1511 from ArthurHoaro/wip-slim-routing
Diffstat (limited to 'tests/container/ContainerBuilderTest.php')
-rw-r--r--tests/container/ContainerBuilderTest.php34
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;
7use PHPUnit\Framework\TestCase; 7use PHPUnit\Framework\TestCase;
8use Shaarli\Bookmark\BookmarkServiceInterface; 8use Shaarli\Bookmark\BookmarkServiceInterface;
9use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
10use Shaarli\Feed\FeedBuilder;
11use Shaarli\Formatter\FormatterFactory;
10use Shaarli\History; 12use Shaarli\History;
13use Shaarli\Http\HttpAccess;
14use Shaarli\Netscape\NetscapeBookmarkUtils;
15use Shaarli\Plugin\PluginManager;
11use Shaarli\Render\PageBuilder; 16use Shaarli\Render\PageBuilder;
17use Shaarli\Render\PageCacheManager;
18use Shaarli\Security\CookieManager;
12use Shaarli\Security\LoginManager; 19use Shaarli\Security\LoginManager;
13use Shaarli\Security\SessionManager; 20use Shaarli\Security\SessionManager;
21use Shaarli\Thumbnailer;
22use Shaarli\Updater\Updater;
14 23
15class ContainerBuilderTest extends TestCase 24class 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}