1
0
Fork 0

Merge pull request #1128 from hason/dumper

Added support for the root package in the array dumper
pull/1131/head
Jordi Boggiano 2012-09-20 01:14:11 -07:00
commit a35e68670a
2 changed files with 19 additions and 0 deletions

View File

@ -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;
} }

View File

@ -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
*/ */