Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 16
DockerTest
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 16
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 handle
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 13
1<?php
2
3namespace Qmp\Laravel\DockerScale\Console;
4
5use Exception;
6use Illuminate\Console\Command;
7use Illuminate\Support\Facades\Log;
8use Qmp\Laravel\AsyncProcessFactory\Traits\ProcessFactoryStarted;
9class DockerTest extends Command
10{
11
12    use ProcessFactoryStarted;
13    /**
14     * The name and signature of the console command.
15     *
16     * @var string
17     */
18    protected $signature = 'docker:test {--sleep=120} {--error=false} {--detached=false}';
19
20    /**
21     * The console command description.
22     *
23     * @var string
24     */
25    protected $description = 'Run test artisan command in docker context';
26
27    /**
28     * Create a new command instance.
29     *
30     * @return void
31     */
32    public function __construct()
33    {
34        parent::__construct();
35        $this->ignoreValidationErrors();
36    }
37
38    /**
39     * Execute the console command.
40     *
41     * @return mixed
42     */
43    public function handle()
44    {
45        $this->info('begin : Display this on the screen bla bla bla');
46        
47        if($this->option('error') == 'true') {
48            Log::debug('-------- ERROR --------');
49            $stdErr = $this->getOutput()->getErrorStyle();
50            $stdErr->writeln('error !');
51        }
52
53        if($this->option('detached') == 'true') {
54            Log::debug('-------- DETACHED --------');
55            $this->hasStarted();
56        }
57        
58        Log::debug('on++++++++++');
59        sleep($this->option('sleep'));
60        Log::debug('off++++++++++');
61
62        $this->info('end : Display this on the screen bla bla bla');
63    }
64}