AbstractMessageTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 71
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testConstructor() 0 4 1
A tearDown() 0 5 1
A testSetGetConfig() 0 7 1
A testGetSetInput() 0 7 1
A testGetSetOutput() 0 7 1
A testGetSetCliCommand() 0 7 1
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace BaleenTest\Cli\CommandBus;
21
22
use Baleen\Cli\CommandBus\AbstractMessage;
23
use Baleen\Cli\CommandBus\MessageInterface;
24
use Baleen\Cli\Config\Config;
25
use BaleenTest\Cli\BaseTestCase;
26
use Mockery as m;
27
use Symfony\Component\Console\Command\Command;
28
use Symfony\Component\Console\Input\InputInterface;
29
use Symfony\Component\Console\Output\OutputInterface;
30
31
/**
32
 * Class AbstractMessageTest
33
 * @author Gabriel Somoza <[email protected]>
34
 */
35
class AbstractMessageTest extends BaseTestCase
36
{
37
    /** @var m\Mock|AbstractMessage */
38
    protected $instance;
39
40
    /**
41
     * setUp
42
     */
43
    public function setUp()
44
    {
45
        $this->instance = m::mock(AbstractMessage::class)->makePartial();
46
    }
47
48
    public function testConstructor()
49
    {
50
        $this->assertInstanceOf(MessageInterface::class, $this->instance);
51
    }
52
53
    /**
54
     * tearDown
55
     */
56
    public function tearDown()
57
    {
58
        parent::tearDown();
59
        $this->instance = null;
60
    }
61
62
    /**
63
     * testSetGetConfig
64
     */
65
    public function testSetGetConfig()
66
    {
67
        /** @var Config $config */
68
        $config = m::mock(Config::class);
69
        $this->instance->setConfig($config);
70
        $this->assertSame($config, $this->instance->getConfig());
71
    }
72
73
    /**
74
     * testGetSetInput
75
     */
76
    public function testGetSetInput()
77
    {
78
        /** @var InputInterface $input */
79
        $input = m::mock(InputInterface::class);
80
        $this->instance->setInput($input);
81
        $this->assertSame($input, $this->instance->getInput());
82
    }
83
84
    /**
85
     * testGetSetOutput
86
     */
87
    public function testGetSetOutput()
88
    {
89
        /** @var OutputInterface $output */
90
        $output = m::mock(OutputInterface::class);
91
        $this->instance->setOutput($output);
92
        $this->assertSame($output, $this->instance->getOutput());
93
    }
94
95
    /**
96
     * testGetSetCliCommand
97
     */
98
    public function testGetSetCliCommand()
99
    {
100
        /** @var Command $cliCommand */
101
        $cliCommand = m::mock(Command::class);
102
        $this->instance->setCliCommand($cliCommand);
103
        $this->assertSame($cliCommand, $this->instance->getCliCommand());
104
    }
105
}
106