Merge pull request #1128 from hason/dumper
Added support for the root package in the array dumperpull/1131/head
commit
a35e68670a
|
@ -15,6 +15,7 @@ namespace Composer\Package\Dumper;
|
||||||
use Composer\Package\BasePackage;
|
use Composer\Package\BasePackage;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Package\CompletePackageInterface;
|
use Composer\Package\CompletePackageInterface;
|
||||||
|
use Composer\Package\RootPackageInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
* @author Konstantin Kudryashiv <ever.zet@gmail.com>
|
||||||
|
@ -88,6 +89,13 @@ class ArrayDumper
|
||||||
$data = $this->dumpValues($package, $keys, $data);
|
$data = $this->dumpValues($package, $keys, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($package instanceof RootPackageInterface) {
|
||||||
|
$minimumStability = $package->getMinimumStability();
|
||||||
|
if ($minimumStability) {
|
||||||
|
$data['minimum-stability'] = $minimumStability;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,17 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRootPackage()
|
||||||
|
{
|
||||||
|
$this->package = $this->getMock('Composer\Package\RootPackageInterface');
|
||||||
|
|
||||||
|
$this
|
||||||
|
->packageExpects('getMinimumStability', 'dev');
|
||||||
|
|
||||||
|
$config = $this->dumper->dump($this->package);
|
||||||
|
$this->assertSame('dev', $config['minimum-stability']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getKeys
|
* @dataProvider getKeys
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue