Passed
Pull Request — master (#3)
by Stanislau
04:15 queued 01:16
created

TwigPluginTest::testProvideDependencies()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Plugin\Twig\Test\Unit;
15
16
use Micro\Component\DependencyInjection\Autowire\ContainerAutowire;
17
use Micro\Component\DependencyInjection\Container;
18
use Micro\Framework\Kernel\Configuration\ApplicationConfigurationInterface;
19
use Micro\Framework\Kernel\KernelInterface;
20
use Micro\Plugin\Twig\TwigFacadeInterface;
21
use Micro\Plugin\Twig\TwigPlugin;
22
use Micro\Plugin\Twig\TwigPluginConfiguration;
23
use Micro\Plugin\Twig\TwigPluginConfigurationInterface;
24
use PHPUnit\Framework\TestCase;
25
26
class TwigPluginTest extends TestCase
27
{
28
    private TwigPlugin $plugin;
29
30
    private TwigPluginConfigurationInterface $pluginConfiguration;
31
32
    private ApplicationConfigurationInterface $applicationConfiguration;
33
34
    protected function setUp(): void
35
    {
36
        $this->applicationConfiguration = $this->createMock(ApplicationConfigurationInterface::class);
37
        $this->pluginConfiguration = new TwigPluginConfiguration($this->applicationConfiguration);
38
        $this->plugin = new TwigPlugin();
39
        $this->plugin->setConfiguration($this->pluginConfiguration);
40
    }
41
42
    public function testProvideDependencies()
43
    {
44
        $kernel = $this->createMock(KernelInterface::class);
45
        $container = new ContainerAutowire(new Container());
46
        $container->register(KernelInterface::class, fn () => $kernel);
47
        $this->plugin->provideDependencies($container);
48
        $this->assertInstanceOf(TwigFacadeInterface::class, $container->get(TwigFacadeInterface::class));
49
    }
50
}
51