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

ExecuteCodeTest::testThatExceptionIsPropagated()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 1
eloc 15
nc 1
nop 0
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