public function getInstance(array $values = []) { $queue = new \Ds\PriorityQueue(); foreach ($values as $value => $priority) { $queue->push($value, $priority); } return $queue; }
/** * @dataProvider pushDataProvider */ public function testPushAllFromPriorityQueue(array $values, array $expected) { $instance = $this->getInstance(); $queue = new \Ds\PriorityQueue(); foreach ($values as $value) { $queue->push($value, 0); } $instance->pushAll($queue); $this->assertToArray($expected, $instance); $this->assertCount(0, $queue); }