Completed
Push — master ( 3e91ce...851d6f )
by Christian
02:31
created

ExecuteCodeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 5
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testThatExceptionIsPropagated() 0 25 1
1
<?php
2
3
namespace uuf6429\ElderBrother\Action;
4
5
use Symfony\Component\Console\Input;
6
use Symfony\Component\Console\Output;
7
use uuf6429\ElderBrother\Config\ConfigInterface;
8
9
class ExecuteCodeTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testThatExceptionIsPropagated()
12
    {
13
        $action = new ExecuteCode(
14
            'Do something',
15
            function ($config, $input, $output) {
16
                $this->assertInstanceOf(ConfigInterface::class, $config);
17
                $this->assertInstanceOf(Input\InputInterface::class, $input);
18
                $this->assertInstanceOf(Output\OutputInterface::class, $output);
19
20
                throw new \RuntimeException('Testing');
21
            }
22
        );
23
24
        $action->setConfig(
25
            $this->getMockBuilder(ConfigInterface::class)
26
                ->disableOriginalConstructor()
27
                ->getMock()
28
        );
29
30
        $this->setExpectedException(\RuntimeException::class, 'Testing');
31
32
        $action->execute(new Input\StringInput(''), new Output\NullOutput());
33
34
        $this->assertSame('Do something (ExecuteCode)', $action->getName());
35
    }
36
}
37