GeneratorFactoryTest::testCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 29
rs 9.6
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\DTO\Test\Unit\Business\Generator;
15
16
use Micro\Plugin\DTO\Business\FileLocator\FileLocatorFactoryInterface;
17
use Micro\Plugin\DTO\Business\Generator\GeneratorFactory;
18
use Micro\Plugin\DTO\DTOPluginConfigurationInterface;
19
use Micro\Plugin\Logger\Facade\LoggerFacadeInterface;
20
use PHPUnit\Framework\TestCase;
21
use Psr\Log\LoggerInterface;
22
23
class GeneratorFactoryTest extends TestCase
24
{
25
    public function testCreate()
26
    {
27
        $logger = $this->createMock(LoggerInterface::class);
28
        $loggerFacade = $this->createMock(LoggerFacadeInterface::class);
29
        $loggerFacade
30
            ->expects($this->once())
31
            ->method('getLogger')
32
            ->with('test')
33
            ->willReturn($logger);
34
35
        $pluginCfg = $this->createMock(DTOPluginConfigurationInterface::class);
36
        $pluginCfg
37
            ->expects($this->once())
38
            ->method('getLoggerName')
39
            ->willReturn('test');
40
41
        $fileLocatorFactory = $this->createMock(FileLocatorFactoryInterface::class);
42
43
        $factory = new GeneratorFactory(
44
            $fileLocatorFactory,
45
            $pluginCfg,
46
            $loggerFacade,
47
        );
48
49
        $generator = $factory->create();
50
51
        $this->assertNotNull($generator);
52
53
        $generator->generate();
54
    }
55
}
56