Completed
Pull Request — stable (#91)
by Mior Muhammad Zaki
11:58
created

TestCommand::handle()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 1
nop 0
crap 6
1
<?php
2
3
namespace NunoMaduro\Collision\Adapters\Laravel\Commands;
4
5
use Illuminate\Console\Command;
6
use NunoMaduro\Collision\Adapters\Phpunit\TestRunner;
7
8
class TestCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'test {--without-tty : Disable output to TTY}';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Run the application tests';
23
24
    /**
25
     * The arguments to be used while calling phpunit.
26
     *
27
     * @var array
28
     */
29
    protected $arguments = [
30
        '--printer',
31
        'NunoMaduro\Collision\Adapters\Phpunit\Printer',
32
    ];
33
34
    /**
35
     * Create a new command instance.
36
     *
37
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
38
     */
39
    public function __construct()
40
    {
41
        parent::__construct();
42
43
        $this->ignoreValidationErrors();
44
    }
45
46
    /**
47
     * Execute the console command.
48
     *
49
     * @return mixed
50
     */
51
    public function handle()
52
    {
53
        $withoutTty = $this->option('without-tty');
54
55
        $options = \array_slice($_SERVER['argv'], $withoutTty ? 3 : 2);
56
57
        $runner = new TestRunner(base_path(), (bool) $withoutTty);
58
59
        return $runner($this->output, $options);
60
    }
61
}
62