aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/container/ContainerBuilderTest.php
blob: 9b97ed6d6f4b71c5b342189f406a7d57c075c637 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

declare(strict_types=1);

namespace Shaarli\Container;

use PHPUnit\Framework\TestCase;
use Shaarli\Bookmark\BookmarkServiceInterface;
use Shaarli\Config\ConfigManager;
use Shaarli\History;
use Shaarli\Render\PageBuilder;
use Shaarli\Security\LoginManager;
use Shaarli\Security\SessionManager;

class ContainerBuilderTest extends TestCase
{
    /** @var ConfigManager */
    protected $conf;

    /** @var SessionManager */
    protected $sessionManager;

    /** @var LoginManager */
    protected $loginManager;

    /** @var ContainerBuilder */
    protected $containerBuilder;

    public function setUp(): void
    {
        $this->conf = new ConfigManager('tests/utils/config/configJson');
        $this->sessionManager = $this->createMock(SessionManager::class);
        $this->loginManager = $this->createMock(LoginManager::class);

        $this->containerBuilder = new ContainerBuilder($this->conf, $this->sessionManager, $this->loginManager);
    }

    public function testBuildContainer(): void
    {
        $container = $this->containerBuilder->build();

        static::assertInstanceOf(ConfigManager::class, $container->conf);
        static::assertInstanceOf(SessionManager::class, $container->sessionManager);
        static::assertInstanceOf(LoginManager::class, $container->loginManager);
        static::assertInstanceOf(History::class, $container->history);
        static::assertInstanceOf(BookmarkServiceInterface::class, $container->bookmarkService);
        static::assertInstanceOf(PageBuilder::class, $container->pageBuilder);
    }
}