@@ -16,6 +16,7 @@ class Unit
16
16
private Command $ command ;
17
17
private bool $ quite ;
18
18
private ?string $ title = null ;
19
+ private string $ output = "" ;
19
20
private array $ args = [];
20
21
private array $ units ;
21
22
private int $ index = 0 ;
@@ -67,7 +68,9 @@ public function add(string $message, callable $callback): void
67
68
$ hasError = false ;
68
69
$ test = $ this ->unitTest ();
69
70
// Make the tests
71
+ ob_start ();
70
72
$ callback ($ test );
73
+ $ this ->output .= ob_get_clean ();
71
74
// Get the tests results
72
75
$ data = $ test ->getTestResult ();
73
76
$ index = $ this ->index -1 ;
@@ -86,6 +89,35 @@ public function add(string $message, callable $callback): void
86
89
}
87
90
}
88
91
92
+ /**
93
+ * Access command instance
94
+ * @return Command
95
+ */
96
+ public function command (): Command
97
+ {
98
+ return $ this ->command ;
99
+ }
100
+
101
+ /**
102
+ * Print message
103
+ * @param string $message
104
+ * @return false|string
105
+ */
106
+ public function message (string $ message ): false |string
107
+ {
108
+ return $ this ->command ->message ($ message );
109
+ }
110
+
111
+ /**
112
+ * confirm for execute
113
+ * @param string $message
114
+ * @return bool
115
+ */
116
+ public function confirm (string $ message = "Do you wish to continue? " ): bool
117
+ {
118
+ return $ this ->command ->confirm ($ message );
119
+ }
120
+
89
121
/**
90
122
* Execute tests suite
91
123
* @return void
@@ -112,6 +144,8 @@ public function execute(): void
112
144
} elseif (!$ this ->quite ) {
113
145
$ this ->command ->approve ("Every test has been successfully run! " );
114
146
}
147
+
148
+ $ this ->command ->message ($ this ->output );
115
149
}
116
150
117
151
/**
0 commit comments