1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Show that no version was found in composer show/license if root package is auto-versioned, fixes #4158

This commit is contained in:
Jordi Boggiano 2015-06-18 23:47:17 +01:00
parent c8eca6f198
commit a943827371
2 changed files with 31 additions and 1 deletions

View file

@ -118,6 +118,31 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("dev-foo", $package->getVersion());
}
public function testNoVersionIsVisibleInPrettyVersion()
{
$manager = $this->getMockBuilder('\\Composer\\Repository\\RepositoryManager')
->disableOriginalConstructor()
->getMock();
$self = $this;
/* Can do away with this mock object when https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81 is fixed */
$processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')
->disableOriginalConstructor()
->getMock();
$processExecutor->expects($this->any())
->method('execute')
->willReturn(null);
$config = new Config;
$config->merge(array('repositories' => array('packagist' => false)));
$loader = new RootPackageLoader($manager, $config, null, $processExecutor);
$package = $loader->load(array());
$this->assertEquals("1.0.0.0", $package->getVersion());
$this->assertEquals("No version set (parsed as 1.0.0)", $package->getPrettyVersion());
}
protected function loadPackage($data)
{
$manager = $this->getMockBuilder('\\Composer\\Repository\\RepositoryManager')