mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
Add test for Pool handling and refactor a couple things
This commit is contained in:
parent
0936670213
commit
453b9a616b
6 changed files with 41 additions and 11 deletions
|
@ -33,10 +33,16 @@ class Pool
|
|||
protected $acceptableStabilities;
|
||||
protected $stabilityFlags;
|
||||
|
||||
// TODO BC change to stable end of june?
|
||||
public function __construct($minimumStability = 'dev', array $stabilityFlags = array())
|
||||
{
|
||||
$stabilities = BasePackage::$stabilities;
|
||||
$this->acceptableStabilities = array_flip(array_splice($stabilities, 0, array_search($minimumStability, $stabilities) + 1));
|
||||
$this->acceptableStabilities = array();
|
||||
foreach (BasePackage::$stabilities as $stability => $value) {
|
||||
if ($value <= BasePackage::$stabilities[$minimumStability]) {
|
||||
$this->acceptableStabilities[$stability] = $value;
|
||||
}
|
||||
}
|
||||
$this->stabilityFlags = $stabilityFlags;
|
||||
}
|
||||
|
||||
|
@ -69,7 +75,7 @@ class Pool
|
|||
&& isset($this->acceptableStabilities[$stability]))
|
||||
// allow if package matches the package-specific stability flag
|
||||
|| (isset($this->stabilityFlags[$name])
|
||||
&& array_search($stability, BasePackage::$stabilities) <= $this->stabilityFlags[$name]
|
||||
&& BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$name]
|
||||
)
|
||||
) {
|
||||
$package->setId($id++);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue