Completed
Push — master ( ea9d41...184c59 )
by Sergii
08:21
created

ProcessorTest::testInvalidTask()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
namespace Tests\AppBundle\Sync;
3
4
use AppBundle\Sync\Entity\Task;
5
use AppBundle\Sync\Processor;
6
use AppBundle\Sync\Entity\Task\Add;
7
use AppBundle\Sync\Entity\Task\Delete;
8
use AppBundle\Sync\Entity\Task\Update;
9
use AppBundle\Sync\Storage\StorageInterface;
10
11
/**
12
 * Task Processor tests
13
 *
14
 * @author Sergey Sadovoi <[email protected]>
15
 */
16
class ProcessorTest extends \PHPUnit_Framework_TestCase
17
{
18 View Code Duplication
    public function testAdd()
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...
19
    {
20
        $storage = $this->getMockForAbstractClass(StorageInterface::class);
21
        $storage->expects($this->once())
22
                ->method('put');
23
24
        $processor = new Processor($storage);
25
        $task = new Add();
26
27
        $processor->execute($task);
28
    }
29
30 View Code Duplication
    public function testUpdate()
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...
31
    {
32
        $storage = $this->getMockForAbstractClass(StorageInterface::class);
33
        $storage->expects($this->once())
34
                ->method('put');
35
36
        $processor = new Processor($storage);
37
        $task = new Update();
38
39
        $processor->execute($task);
40
    }
41
42 View Code Duplication
    public function testDelete()
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...
43
    {
44
        $storage = $this->getMockForAbstractClass(StorageInterface::class);
45
        $storage->expects($this->once())
46
                ->method('delete');
47
48
        $processor = new Processor($storage);
49
        $task = new Delete();
50
51
        $processor->execute($task);
52
    }
53
54
    /**
55
     * @expectedException \AppBundle\Exception\TaskException
56
     * @expectedExceptionCode \AppBundle\Exception\TaskException::INVALID_TASK
57
     */
58 View Code Duplication
    public function testInvalidTask()
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...
59
    {
60
        $storage = $this->getMockForAbstractClass(StorageInterface::class);
61
        $processor = new Processor($storage);
62
        $task = $this->getMockBuilder(Task::class)
63
            ->getMock();
64
65
        $processor->execute($task);
66
    }
67
}
68