Skip to content

Commit b6a8412

Browse files
committed
ITT: Fixture commands for tests added.
1 parent 5fb1c1e commit b6a8412

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Illuminate\Console\Command;
4+
use Illuminate\Console\ConfirmableTrait;
5+
6+
class ConfirmableTraitCommand extends Command
7+
{
8+
use ConfirmableTrait;
9+
10+
protected $signature = 'confirmable {--force : Force to run without confirmation}';
11+
12+
public function handle()
13+
{
14+
if (!$this->confirmToProceed('Attention, please!', true)) {
15+
return;
16+
}
17+
18+
$this->info('Done!');
19+
}
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use Illuminate\Console\Command;
4+
5+
class ConfirmationCommand extends Command
6+
{
7+
protected $signature = 'confirmation';
8+
9+
public function handle()
10+
{
11+
if (!$this->confirm('Are you sure?')) {
12+
return;
13+
}
14+
15+
$this->info('Done!');
16+
}
17+
}

tests/fixture/app/Console/Kernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ class Kernel extends \Orchestra\Testbench\Console\Kernel
55
protected $commands = [
66
GenericCommand::class,
77
TableOutputCommand::class,
8+
ConfirmationCommand::class,
9+
ConfirmableTraitCommand::class,
810
];
911
}

0 commit comments

Comments
 (0)