itCreatesKernelOnCreateService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 11

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Go\Zend\Framework\Tests\Unit\Factory;
4
5
use Go\Core\AspectKernel;
6
use Go\Zend\Framework\Factory\AspectKernelFactory;
7
use Go\Zend\Framework\Module;
8
use PHPUnit\Framework\TestCase;
9
use Zend\ServiceManager\ServiceLocatorInterface;
10
11
/**
12
 * @package Go\Zend\Framework\Tests\Unit\Factory
13
 */
14
class AspectKernelFactoryTest extends TestCase
15
{
16
    /**
17
     * @test
18
     */
19 View Code Duplication
    public function itCreatesKernelOnInvoke()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $serviceLocator = $this->prophesize(ServiceLocatorInterface::class);
22
        $serviceLocator->get('config')
23
            ->willReturn([Module::CONFIG_KEY => require __DIR__ . '/../../resources/goaop_module.php'])
24
            ->shouldBeCalled();
25
26
        $factory = new AspectKernelFactory();
27
28
        $instance = $factory($serviceLocator->reveal(), AspectKernel::class);
29
30
        $this->assertInstanceOf(
31
            AspectKernel::class,
32
            $instance,
33
            'factory should return an instance of ' . AspectKernel::class
34
        );
35
    }
36
37
    /**
38
     * @test
39
     */
40 View Code Duplication
    public function itCreatesKernelOnCreateService()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $serviceLocator = $this->prophesize(ServiceLocatorInterface::class);
43
        $serviceLocator->get('config')
44
            ->willReturn([Module::CONFIG_KEY => require __DIR__ . '/../../resources/goaop_module.php'])
45
            ->shouldBeCalled();
46
47
        $factory = new AspectKernelFactory();
48
49
        $instance = $factory->createService($serviceLocator->reveal());
50
51
        $this->assertInstanceOf(
52
            AspectKernel::class,
53
            $instance,
54
            'factory should return an instance of ' . AspectKernel::class
55
        );
56
    }
57
}