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

PluginClassResolverCacheDecoratorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testResolve() 0 14 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\Plugin;
15
16
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverCacheDecorator;
17
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverInterface;
18
use PHPUnit\Framework\TestCase;
19
20
class PluginClassResolverCacheDecoratorTest extends TestCase
21
{
22
    public function testResolve()
23
    {
24
        $alias = '@alias';
25
        $plugin = new \stdClass();
26
27
        $resolver = $this->createMock(PluginClassResolverInterface::class);
28
        $resolver->expects($this->once())->method('resolve')->with($alias)->willReturn($plugin);
29
30
        $decorator = new PluginClassResolverCacheDecorator(
31
            $resolver
32
        );
33
34
        $this->assertEquals($plugin, $decorator->resolve($alias));
35
        $this->assertEquals($plugin, $decorator->resolve($alias)); // cached
36
    }
37
}
38