|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Steevanb\ParallelProcess\Tests\Console\Application\Theme\SummaryTheme; |
| 6 | + |
| 7 | +use PHPUnit\Framework\TestCase; |
| 8 | +use Steevanb\ParallelProcess\{ |
| 9 | + Console\Application\Theme\SummaryTheme, |
| 10 | + Process\ProcessArray, |
| 11 | + Tests\Console\Output\TestOutput, |
| 12 | + Tests\CreateLsProcessTrait |
| 13 | +}; |
| 14 | + |
| 15 | +/** @covers \Steevanb\ParallelProcess\Console\Application\Theme\SummaryTheme::outputProcessesState */ |
| 16 | +final class OutputProcessStateTest extends TestCase |
| 17 | +{ |
| 18 | + use CreateLsProcessTrait; |
| 19 | + |
| 20 | + public function testEmptyNotStarted(): void |
| 21 | + { |
| 22 | + $output = new TestOutput(); |
| 23 | + (new SummaryTheme())->outputProcessesState( |
| 24 | + $output, |
| 25 | + new ProcessArray() |
| 26 | + ); |
| 27 | + |
| 28 | + static::assertSame('', $output->getOutputed()); |
| 29 | + } |
| 30 | + |
| 31 | + public function testNotStarted(): void |
| 32 | + { |
| 33 | + $output = new TestOutput(); |
| 34 | + (new SummaryTheme())->outputProcessesState( |
| 35 | + $output, |
| 36 | + new ProcessArray([$this->createLsProcess()]) |
| 37 | + ); |
| 38 | + |
| 39 | + static::assertSame('', $output->getOutputed()); |
| 40 | + } |
| 41 | + |
| 42 | + public function testStarted(): void |
| 43 | + { |
| 44 | + $process1 = $this->createLsProcess(); |
| 45 | + $process1->mustRun(); |
| 46 | + |
| 47 | + $process2 = $this->createLsProcess(); |
| 48 | + $process2->mustRun(); |
| 49 | + |
| 50 | + $processes = new ProcessArray([$process1, $process2]); |
| 51 | + |
| 52 | + $output = new TestOutput(); |
| 53 | + |
| 54 | + (new SummaryTheme())->outputProcessesState($output, $processes); |
| 55 | + |
| 56 | + static::assertSame('', $output->getOutputed()); |
| 57 | + } |
| 58 | +} |
0 commit comments