1 <?php
2
3 namespace Skimia\Foundation\Testing\Traits;
4
5 use Skimia\Foundation\Testing\CommandOutput;
6
7 trait TestableCommandTrait
8 {
9 protected $commandOutput = null;
10
11 public function setCommandOutput(CommandOutput $commandOutput)
12 {
13 $this->commandOutput = $commandOutput;
14 }
15
16 17 18 19 20 21 22
23 public function ask($question, $default = null)
24 {
25
26 if (isset($this->commandOutput)) {
27 $this->commandOutput->writeln('<ask>'.$question.'</ask>');
28 } else {
29 return;
30 }
31
32 return $default;
33 }
34 }
35