| @@ 237-261 (lines=25) @@ | ||
| 234 | $this->assertFalse($run->poll()); |
|
| 235 | } |
|
| 236 | ||
| 237 | public function testUpdateOnPollOffDoesNotUpdateOnPoll() |
|
| 238 | { |
|
| 239 | $process = Mockery::mock(Process::class); |
|
| 240 | $process->shouldReceive('stop'); |
|
| 241 | ||
| 242 | $process->shouldReceive('start')->once(); |
|
| 243 | ||
| 244 | $run = new Run( |
|
| 245 | $process, |
|
| 246 | null, |
|
| 247 | null, |
|
| 248 | function () { |
|
| 249 | $this->fail('onProgress should not be called'); |
|
| 250 | } |
|
| 251 | ); |
|
| 252 | $run->setUpdateOnPoll(false); |
|
| 253 | ||
| 254 | $process->shouldReceive('isStarted')->andReturn(true); |
|
| 255 | $process->shouldReceive('isRunning')->andReturn(false, true, false); |
|
| 256 | $process->shouldReceive('isSuccessful')->once()->andReturn(true); |
|
| 257 | ||
| 258 | $run->start(); |
|
| 259 | $this->assertTrue($run->poll()); |
|
| 260 | $this->assertFalse($run->poll()); |
|
| 261 | } |
|
| 262 | ||
| 263 | public function testUpdateOnOutputOffDoesNotCallUpdateOnOutput() |
|
| 264 | { |
|
| @@ 263-296 (lines=34) @@ | ||
| 260 | $this->assertFalse($run->poll()); |
|
| 261 | } |
|
| 262 | ||
| 263 | public function testUpdateOnOutputOffDoesNotCallUpdateOnOutput() |
|
| 264 | { |
|
| 265 | $process = Mockery::mock(Process::class); |
|
| 266 | $process->shouldReceive('stop'); |
|
| 267 | ||
| 268 | $process->shouldReceive('start') |
|
| 269 | ->with( |
|
| 270 | Mockery::on( |
|
| 271 | function (callable $fn) { |
|
| 272 | $this->assertNotNull($fn); |
|
| 273 | $fn(Process::STDOUT, 'some text'); |
|
| 274 | return true; |
|
| 275 | } |
|
| 276 | ) |
|
| 277 | ) |
|
| 278 | ->once(); |
|
| 279 | ||
| 280 | $run = new Run( |
|
| 281 | $process, |
|
| 282 | null, |
|
| 283 | null, |
|
| 284 | function () { |
|
| 285 | $this->fail('onProgress should not be called'); |
|
| 286 | } |
|
| 287 | ); |
|
| 288 | $run->setUpdateOnProcessOutput(false); |
|
| 289 | ||
| 290 | $process->shouldReceive('isStarted')->andReturn(true); |
|
| 291 | $process->shouldReceive('isRunning')->andReturn(false); |
|
| 292 | $process->shouldReceive('isSuccessful')->once()->andReturn(true); |
|
| 293 | ||
| 294 | $run->start(); |
|
| 295 | $this->assertFalse($run->poll()); |
|
| 296 | } |
|
| 297 | } |
|
| 298 | ||