Completed
Branch master (4042af)
by Aleksandar
02:14
created

MenuUrlHelperFactoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 17
loc 17
rs 10
c 1
b 0
f 0
wmc 1
lcom 1
cbo 5

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Menu\Test\View\Helper;
6
7
class MenuUrlHelperFactoryTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testInvokingMenuItemsFactoryShouldReturnExpectedInstance()
10
    {
11
        $urlHelper = $this->getMockBuilder(\Zend\Expressive\Helper\UrlHelper::class)
12
            ->disableOriginalConstructor()
13
            ->getMockForAbstractClass();
14
        $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class)
15
            ->setMethods(['get'])
16
            ->getMockForAbstractClass();
17
        $container->expects(static::at(0))
18
            ->method('get')
19
            ->will(static::returnValue($urlHelper));
20
        $factory = new \Menu\View\Helper\MenuUrlHelperFactory();
21
        static::assertInstanceOf(\Menu\View\Helper\MenuUrlHelper::class, $factory($container, 'test'));
22
    }
23
}
24