|
@@ 106-123 (lines=18) @@
|
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
/** @depends testAdd */ |
| 106 |
|
public function testGetRunning() |
| 107 |
|
{ |
| 108 |
|
$queue = new ProcessQueue(); |
| 109 |
|
$process = new Process('sleep 0.1'); |
| 110 |
|
|
| 111 |
|
$queue->add($process); |
| 112 |
|
|
| 113 |
|
$this->assertEmpty($queue->getRunning()); |
| 114 |
|
|
| 115 |
|
$process->start(); |
| 116 |
|
|
| 117 |
|
$running = $queue->getRunning(); |
| 118 |
|
|
| 119 |
|
$this->assertInstanceOf(Collection::class, $running); |
| 120 |
|
$this->assertContainsOnly(Process::class, $running); |
| 121 |
|
$this->assertInstanceOf(Process::class, $running->get(0)); |
| 122 |
|
$this->assertSame($process, $running->get(0)); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
/** @depends testAdd */ |
| 126 |
|
public function testGetCompleted() |
|
@@ 126-143 (lines=18) @@
|
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
/** @depends testAdd */ |
| 126 |
|
public function testGetCompleted() |
| 127 |
|
{ |
| 128 |
|
$queue = new ProcessQueue(); |
| 129 |
|
$process = new Process('pwd'); |
| 130 |
|
|
| 131 |
|
$queue->add($process); |
| 132 |
|
|
| 133 |
|
$this->assertEmpty($queue->getCompleted()); |
| 134 |
|
|
| 135 |
|
$process->run(); |
| 136 |
|
|
| 137 |
|
$completed = $queue->getCompleted(); |
| 138 |
|
|
| 139 |
|
$this->assertInstanceOf(Collection::class, $completed); |
| 140 |
|
$this->assertContainsOnly(Process::class, $completed); |
| 141 |
|
$this->assertInstanceOf(Process::class, $completed->get(0)); |
| 142 |
|
$this->assertSame($process, $completed->get(0)); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
/** @depends testAdd */ |
| 146 |
|
public function testResolve() |