|
@@ 255-292 (lines=38) @@
|
| 252 |
|
$this->compareOutputs($expected, $this->output->getWritten()); |
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
public function testShowTypeDoesNotOutputTheStdOrErrInformation() |
| 256 |
|
{ |
| 257 |
|
$process = Mockery::mock(Process::class); |
| 258 |
|
$process->shouldReceive('stop'); |
| 259 |
|
$process->shouldReceive('start')->with( |
| 260 |
|
Mockery::on( |
| 261 |
|
function ($closure) { |
| 262 |
|
call_user_func($closure, Process::OUT, 'first line'); |
| 263 |
|
return true; |
| 264 |
|
} |
| 265 |
|
) |
| 266 |
|
)->once(); |
| 267 |
|
$process->shouldReceive('isStarted')->andReturn(true); |
| 268 |
|
$process->shouldReceive('isRunning')->andReturn( |
| 269 |
|
false, // add |
| 270 |
|
false, // start |
| 271 |
|
true, // check |
| 272 |
|
true, // ... |
| 273 |
|
true, |
| 274 |
|
true, |
| 275 |
|
false // complete |
| 276 |
|
); |
| 277 |
|
$process->shouldReceive('isSuccessful')->atLeast()->once()->andReturn(true); |
| 278 |
|
$process->shouldReceive('getOutput')->andReturn('first line'); |
| 279 |
|
|
| 280 |
|
$this->lines->setShowType(false); |
| 281 |
|
$this->lines->add($process, ['key' => 'value']); |
| 282 |
|
|
| 283 |
|
$this->lines->run(0); |
| 284 |
|
|
| 285 |
|
$expected = [ |
| 286 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> \(<comment>[ 0-9\.s]+</comment>\) <fg=blue>→ Started</>%'], |
| 287 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> \(<comment>[ 0-9\.s]+</comment>\) first line%'], |
| 288 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> \(<comment>[ 0-9\.s]+</comment>\) <info>✓ Succeeded</info>%'], |
| 289 |
|
]; |
| 290 |
|
|
| 291 |
|
$this->compareOutputs($expected, $this->output->getWritten()); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
public function testShowDurationDoesNotShowTheDuration() |
| 295 |
|
{ |
|
@@ 294-331 (lines=38) @@
|
| 291 |
|
$this->compareOutputs($expected, $this->output->getWritten()); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
public function testShowDurationDoesNotShowTheDuration() |
| 295 |
|
{ |
| 296 |
|
$process = Mockery::mock(Process::class); |
| 297 |
|
$process->shouldReceive('stop'); |
| 298 |
|
$process->shouldReceive('start')->with( |
| 299 |
|
Mockery::on( |
| 300 |
|
function ($closure) { |
| 301 |
|
call_user_func($closure, Process::OUT, 'first line'); |
| 302 |
|
return true; |
| 303 |
|
} |
| 304 |
|
) |
| 305 |
|
)->once(); |
| 306 |
|
$process->shouldReceive('isStarted')->andReturn(true); |
| 307 |
|
$process->shouldReceive('isRunning')->andReturn( |
| 308 |
|
false, // add |
| 309 |
|
false, // start |
| 310 |
|
true, // check |
| 311 |
|
true, // ... |
| 312 |
|
true, |
| 313 |
|
true, |
| 314 |
|
false // complete |
| 315 |
|
); |
| 316 |
|
$process->shouldReceive('isSuccessful')->atLeast()->once()->andReturn(true); |
| 317 |
|
$process->shouldReceive('getOutput')->andReturn('first line'); |
| 318 |
|
|
| 319 |
|
$this->lines->setShowDuration(false); |
| 320 |
|
$this->lines->add($process, ['key' => 'value']); |
| 321 |
|
|
| 322 |
|
$this->lines->run(0); |
| 323 |
|
|
| 324 |
|
$expected = [ |
| 325 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> <fg=blue>→ Started</>%'], |
| 326 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> \(out\) first line%'], |
| 327 |
|
['%<info>key</info>: <options=bold;fg=\w+>value</> <info>✓ Succeeded</info>%'], |
| 328 |
|
]; |
| 329 |
|
|
| 330 |
|
$this->compareOutputs($expected, $this->output->getWritten()); |
| 331 |
|
} |
| 332 |
|
} |
| 333 |
|
|