File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,29 @@ public function __construct(Console $console)
6060 */
6161 abstract public function run () : void ;
6262
63+ /**
64+ * Get console instance.
65+ *
66+ * @return Console
67+ */
68+ public function getConsole () : Console
69+ {
70+ return $ this ->console ;
71+ }
72+
73+ /**
74+ * Set console instance.
75+ *
76+ * @param Console $console
77+ *
78+ * @return static
79+ */
80+ public function setConsole (Console $ console ) : static
81+ {
82+ $ this ->console = $ console ;
83+ return $ this ;
84+ }
85+
6386 /**
6487 * Get command name.
6588 *
Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ protected function setUp() : void
2121 $ this ->command = new CommandMock (new Console ());
2222 }
2323
24+ public function testConsole () : void
25+ {
26+ self ::assertInstanceOf (Console::class, $ this ->command ->getConsole ());
27+ $ console = new Console ();
28+ $ this ->command ->setConsole ($ console );
29+ self ::assertSame ($ console , $ this ->command ->getConsole ());
30+ }
31+
2432 public function testName () : void
2533 {
2634 self ::assertSame ('test ' , $ this ->command ->getName ());
You can’t perform that action at this time.
0 commit comments