diff options
Diffstat (limited to 'tests/container')
-rw-r--r-- | tests/container/ContainerBuilderTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/container/ContainerBuilderTest.php b/tests/container/ContainerBuilderTest.php new file mode 100644 index 00000000..9b97ed6d --- /dev/null +++ b/tests/container/ContainerBuilderTest.php | |||
@@ -0,0 +1,49 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Shaarli\Container; | ||
6 | |||
7 | use PHPUnit\Framework\TestCase; | ||
8 | use Shaarli\Bookmark\BookmarkServiceInterface; | ||
9 | use Shaarli\Config\ConfigManager; | ||
10 | use Shaarli\History; | ||
11 | use Shaarli\Render\PageBuilder; | ||
12 | use Shaarli\Security\LoginManager; | ||
13 | use Shaarli\Security\SessionManager; | ||
14 | |||
15 | class ContainerBuilderTest extends TestCase | ||
16 | { | ||
17 | /** @var ConfigManager */ | ||
18 | protected $conf; | ||
19 | |||
20 | /** @var SessionManager */ | ||
21 | protected $sessionManager; | ||
22 | |||
23 | /** @var LoginManager */ | ||
24 | protected $loginManager; | ||
25 | |||
26 | /** @var ContainerBuilder */ | ||
27 | protected $containerBuilder; | ||
28 | |||
29 | public function setUp(): void | ||
30 | { | ||
31 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | ||
32 | $this->sessionManager = $this->createMock(SessionManager::class); | ||
33 | $this->loginManager = $this->createMock(LoginManager::class); | ||
34 | |||
35 | $this->containerBuilder = new ContainerBuilder($this->conf, $this->sessionManager, $this->loginManager); | ||
36 | } | ||
37 | |||
38 | public function testBuildContainer(): void | ||
39 | { | ||
40 | $container = $this->containerBuilder->build(); | ||
41 | |||
42 | static::assertInstanceOf(ConfigManager::class, $container->conf); | ||
43 | static::assertInstanceOf(SessionManager::class, $container->sessionManager); | ||
44 | static::assertInstanceOf(LoginManager::class, $container->loginManager); | ||
45 | static::assertInstanceOf(History::class, $container->history); | ||
46 | static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService); | ||
47 | static::assertInstanceOf(PageBuilder::class, $container->pageBuilder); | ||
48 | } | ||
49 | } | ||