Completed
Push — master ( a5a753...454108 )
by Wachter
07:05
created

TaskBuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 83.33 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 20
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetSystemKey() 10 10 1
A testSetSystemKeyNotSupported() 10 10 1

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
namespace Task\TaskBundle\Unit\Builder;
4
5
use Task\Scheduler\TaskSchedulerInterface;
6
use Task\TaskBundle\Builder\NotSupportedMethodException;
7
use Task\TaskBundle\Builder\TaskBuilder;
8
use Task\TaskBundle\Entity\Task;
9
use Task\TaskInterface;
10
11
class TaskBuilderTest extends \PHPUnit_Framework_TestCase
12
{
13 View Code Duplication
    public function testSetSystemKey()
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...
14
    {
15
        $task = $this->prophesize(Task::class);
16
        $scheduler = $this->prophesize(TaskSchedulerInterface::class);
17
18
        $taskBuilder = new TaskBuilder($task->reveal(), $scheduler->reveal());
19
        $taskBuilder->setSystemKey('test');
20
21
        $task->setSystemKey('test')->shouldBeCalled();
22
    }
23
24 View Code Duplication
    public function testSetSystemKeyNotSupported()
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...
25
    {
26
        $this->setExpectedException(NotSupportedMethodException::class);
27
28
        $task = $this->prophesize(TaskInterface::class);
29
        $scheduler = $this->prophesize(TaskSchedulerInterface::class);
30
31
        $taskBuilder = new TaskBuilder($task->reveal(), $scheduler->reveal());
32
        $taskBuilder->setSystemKey('test');
33
    }
34
}
35