|
@@ 92-109 (lines=18) @@
|
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
/** @depends testAdd */ |
| 92 |
|
public function testGetRunning() |
| 93 |
|
{ |
| 94 |
|
$queue = new ProcessQueue(); |
| 95 |
|
$process = new Process('sleep 0.1'); |
| 96 |
|
|
| 97 |
|
$queue->add($process); |
| 98 |
|
|
| 99 |
|
$this->assertEmpty($queue->getRunning()); |
| 100 |
|
|
| 101 |
|
$process->start(); |
| 102 |
|
|
| 103 |
|
$running = $queue->getRunning(); |
| 104 |
|
|
| 105 |
|
$this->assertInstanceOf(Collection::class, $running); |
| 106 |
|
$this->assertContainsOnly(Process::class, $running); |
| 107 |
|
$this->assertInstanceOf(Process::class, $running->get(0)); |
| 108 |
|
$this->assertSame($process, $running->get(0)); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
/** @depends testAdd */ |
| 112 |
|
public function testGetCompleted() |
|
@@ 112-129 (lines=18) @@
|
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
/** @depends testAdd */ |
| 112 |
|
public function testGetCompleted() |
| 113 |
|
{ |
| 114 |
|
$queue = new ProcessQueue(); |
| 115 |
|
$process = new Process('pwd'); |
| 116 |
|
|
| 117 |
|
$queue->add($process); |
| 118 |
|
|
| 119 |
|
$this->assertEmpty($queue->getCompleted()); |
| 120 |
|
|
| 121 |
|
$process->run(); |
| 122 |
|
|
| 123 |
|
$completed = $queue->getCompleted(); |
| 124 |
|
|
| 125 |
|
$this->assertInstanceOf(Collection::class, $completed); |
| 126 |
|
$this->assertContainsOnly(Process::class, $completed); |
| 127 |
|
$this->assertInstanceOf(Process::class, $completed->get(0)); |
| 128 |
|
$this->assertSame($process, $completed->get(0)); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
/** @depends testAdd */ |
| 132 |
|
public function testResolve() |