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

WebAdminUserHelperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 24
loc 24
rs 10
c 0
b 0
f 0
wmc 2
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 Admin\Test\View\Helper;
6
7
class WebAdminUserHelperTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testInvokingAdminUserHelperShouldReturnItSelf()
10
    {
11
        $adminUserService = $this->getMockBuilder(\Admin\Service\AdminUserService::class)
12
            ->disableOriginalConstructor()
13
            ->getMockForAbstractClass();
14
        $adminUserHelper = new \Admin\View\Helper\WebAdminUserHelper($adminUserService);
15
        static::assertInstanceOf(\Admin\View\Helper\WebAdminUserHelper::class, $adminUserHelper());
16
    }
17
18
    public function testGetRandomShouldReturnArray()
19
    {
20
        $adminUserService = $this->getMockBuilder(\Admin\Service\AdminUserService::class)
21
            ->setMethods(['getForWeb'])
22
            ->disableOriginalConstructor()
23
            ->getMockForAbstractClass();
24
        $adminUserService->expects(static::once())
25
            ->method('getForWeb')
26
            ->willReturn([]);
27
        $adminUserHelper = new \Admin\View\Helper\WebAdminUserHelper($adminUserService);
28
        static::assertSame([], $adminUserHelper->getRandom());
29
    }
30
}
31