Passed
Push — master ( de3440...0452fc )
by Stanislau
03:00 queued 13s
created

PathResolverCacheDecoratorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 15
c 1
b 0
f 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testResolve() 0 20 1
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\Configuration\Helper\Test\Unit\Business\Path;
15
16
use Micro\Plugin\Configuration\Helper\Business\Path\PathResolverCacheDecorator;
17
use Micro\Plugin\Configuration\Helper\Business\Path\PathResolverInterface;
18
use PHPUnit\Framework\TestCase;
19
20
class PathResolverCacheDecoratorTest extends TestCase
21
{
22
    public function testResolve()
23
    {
24
        $acceptedVal = '/path/to/plugin';
25
        $alias = '@test';
26
        $pathResolverMock = $this->createMock(PathResolverInterface::class);
27
        $pathResolverMock
28
            ->expects($this->once())
29
            ->method('resolve')
30
            ->with($alias)
31
            ->willReturn($acceptedVal);
32
33
        $cachedDecorator = new PathResolverCacheDecorator(
34
            $pathResolverMock
35
        );
36
37
        $resultOriginal = $cachedDecorator->resolve($alias);
38
        $resultCached = $cachedDecorator->resolve($alias);
39
40
        $this->assertEquals($acceptedVal, $resultOriginal);
41
        $this->assertEquals($acceptedVal, $resultCached);
42
    }
43
}
44