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
|
|
|
|