Completed
Push — master ( 351bd6...f43dc3 )
by Hugues
02:12
created

TestCommandExecutionCapabilities::executeCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 12
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
3
namespace HMLB\UserBundle\Tests\Functional;
4
5
use Symfony\Bundle\FrameworkBundle\Console\Application;
6
use Symfony\Component\Console\Input\ArrayInput;
7
8
/**
9
 * Trait TestCommandExecutionCapabilities.
10
 *
11
 * @author Hugues Maignol <[email protected]>
12
 */
13
trait TestCommandExecutionCapabilities
14
{
15
    protected function executeCommand($command, array $options = [])
16
    {
17
        $args = [
18
            'command' => $command,
19
        ];
20
        $args['--quiet'] = true;
21
        $args = array_merge($args, $options);
22
23
        $application = new Application($this->kernel);
0 ignored issues
show
Bug introduced by
The property kernel does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
        $application->setAutoExit(false);
25
        $application->run(new ArrayInput($args));
26
    }
27
}
28