PreExecuteEventTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
cbo 4
dl 0
loc 54
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createPreExecuteEvent() 0 8 1
A testFactory() 0 16 1
A testGetTask() 0 9 1
A testGetProcess() 0 9 1
1
<?php
2
/**
3
 * This file is part of Bldr.io
4
 *
5
 * (c) Aaron Scherer <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE
9
 */
10
11
namespace Bldr\Test\Event;
12
13
use Bldr\Event\PreExecuteEvent;
14
15
/**
16
 * @author Mauricio Walters <[email protected]>
17
 */
18
class PreExecuteEventTest extends \PHPUnit_Framework_TestCase
19
{
20
    public static function createPreExecuteEvent()
21
    {
22
        $task    = \Mockery::mock('Bldr\Task\TaskInterface');
23
        $process = \Mockery::mock('Symfony\Component\Process\Process');
24
        $process->shouldReceive('stop');
25
26
        return new PreExecuteEvent($task, $process, false);
0 ignored issues
show
Unused Code introduced by
The call to PreExecuteEvent::__construct() has too many arguments starting with false.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
27
    }
28
29
    /**
30
     * Tests the __construct($task, $builder) method
31
     *
32
     * @throws \PHPUnit_Framework_Exception
33
     * @return PreExecuteEvent
34
     */
35
    public function testFactory()
36
    {
37
        $postExecuteEvent = self::createPreExecuteEvent();
38
39
        $this->assertInstanceOf(
40
            'Bldr\Event\PreExecuteEvent',
41
            $postExecuteEvent
42
        );
43
44
        $this->assertInstanceOf(
45
            'Bldr\Event\AbstractEvent',
46
            $postExecuteEvent
47
        );
48
49
        return $postExecuteEvent;
50
    }
51
52
    public function testGetTask()
53
    {
54
        $postExecuteEvent = self::createPreExecuteEvent();
55
56
        $this->assertInstanceOf(
57
            'Bldr\Task\TaskInterface',
58
            $postExecuteEvent->getTask()
59
        );
60
    }
61
62
    public function testGetProcess()
63
    {
64
        $postExecuteEvent = self::createPreExecuteEvent();
65
66
        $this->assertInstanceOf(
67
            'Symfony\Component\Process\Process',
68
            $postExecuteEvent->getProcess()
69
        );
70
    }
71
}
72