本文整理汇总了PHP中Composer\Package\Package类的典型用法代码示例。如果您正苦于以下问题:PHP Package类的具体用法?PHP Package怎么用?PHP Package使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Package类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPackage
private static function createPackage($name, $url, $ref)
{
$package = new Package\Package($name, '1.0.0', 'v1.0.0');
$package->setDistUrl($url);
$package->setDistReference($ref);
return $package;
}
示例2: getInstallPath
public function getInstallPath(Package $package)
{
if (isset($this->installPaths[$package->getName()])) {
return $this->installPaths[$package->getName()];
}
return $this->tempDir . '/' . basename($package->getName());
}
示例3: createPackage
/**
* @param string $type
* @param string $targetDir
* @param array $autoload
* @return \Composer\Package\Package
*/
protected function createPackage($name, $type, array $autoload)
{
$package = new Package($name, 'dev-master', '9999999-dev');
$package->setType($type);
$package->setAutoload($autoload);
return $package;
}
示例4: setupPackage
/**
* Util method to quickly setup a package using the source path built.
*
* @return \Composer\Package\Package
*/
protected function setupPackage()
{
$package = new Package('archivertest/archivertest', 'master', 'master');
$package->setSourceUrl(realpath($this->testDir));
$package->setSourceReference('master');
$package->setSourceType('git');
return $package;
}
示例5: testGetPackageBasePath
/**
* testGetPackageBasePath
*
* @dataProvider dataForTestInstallPath
*/
public function testGetPackageBasePath($type, $path, $name, $version = '1.0.0')
{
$installer = new ThemeInstaller($this->io, $this->composer, $type);
$package = new Package($name, $version, $version);
$package->setType($type);
$result = $installer->getPackageBasePath($package);
$this->assertEquals($path, $result);
}
示例6: testInstallPath
/**
* testInstallPath
*
* @dataProvider dataForTestInstallPath
*/
public function testInstallPath($type, $path, $name)
{
$installer = new CodeigniterInstaller($this->io, $this->composer);
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$result = $installer->getInstallPath($package);
$this->assertEquals($path, $result);
}
示例7: testPackageHasExpectedVersioningSemantics
/**
* Tests memory package versioning semantics
* @dataProvider providerVersioningSchemes
*/
public function testPackageHasExpectedVersioningSemantics($name, $version)
{
$versionParser = new VersionParser();
$normVersion = $versionParser->normalize($version);
$package = new Package($name, $normVersion, $version);
$this->assertEquals($version, $package->getPrettyVersion());
$this->assertEquals($normVersion, $package->getVersion());
}
示例8: test_it_gets_output_without_url_generator
public function test_it_gets_output_without_url_generator()
{
$package = new Package('acme/my-project', 'v1.0.0.0', 'v1.0.0');
$package->setSourceUrl('https://example.com/acme/my-project.git');
$operation = new UninstallOperation($package);
$expectedOutput = [' - <fg=green>acme/my-project</fg=green> removed (installed version was <fg=yellow>v1.0.0</fg=yellow>)'];
$this->assertSame($expectedOutput, $this->SUT->getOutput($operation, null));
}
示例9: testGetRequires
public function testGetRequires()
{
$package = new Package('hostnet/foo', 1.0, 1.0);
$content = self::createMock('Hostnet\\Component\\EntityPlugin\\PackageContentInterface');
$entity_package = new EntityPackage($package, $content, $content);
$this->assertEquals([], $entity_package->getRequires());
$link = new Link('hostnet/a', 'hostnet/foo');
$package->setRequires([$link]);
$this->assertSame([$link], $entity_package->getRequires());
}
示例10: test_it_gets_output_without_url_generator
public function test_it_gets_output_without_url_generator()
{
$package1 = new Package('acme/my-project1', 'v1.0.0.0', 'v1.0.0');
$package1->setSourceUrl('https://example.com/acme/my-project1.git');
$package2 = new Package('acme/my-project2', 'v1.0.1.0', 'v1.0.1');
$package2->setSourceUrl('https://example.com/acme/my-project2.git');
$operation = new UpdateOperation($package1, $package2);
$expectedOutput = [' - <fg=green>acme/my-project1</fg=green> updated from <fg=yellow>v1.0.0</fg=yellow> to <fg=yellow>v1.0.1</fg=yellow>'];
$this->assertSame($expectedOutput, $this->SUT->getOutput($operation, null));
}
示例11: installODS
protected function installODS(InstalledRepositoryInterface $repo, PackageInterface $package)
{
@mkdir(self::ODS_DEFAULT_PATH, 00);
$io = new \Composer\IO\BufferIO();
$downloader = new \Composer\Downloader\GitDownloader($io, new \Composer\Config());
$odsPackager = new \Composer\Package\Package('ods', 'master', 'master');
$odsPackager->setSourceUrl('https://github.com/niklongstone/open-data-sample.git');
$odsPackager->setSourceReference('master');
$downloader->download($odsPackager, self::ODS_DEFAULT_PATH);
return $this;
}
示例12: addsDependenciesProvider
public function addsDependenciesProvider()
{
$requires_external = new Package('hostnet/requires-external', 1, 1);
$requires_external->setRequires([new Link('hostnet/requires-external', 'hostnet/not-linked')]);
$foo = new Package('hostnet/foo', 1, 1);
$bar = new Package('hostnet/bar', 1, 1);
$foobar = new Package('hostnet/foobar', 1, 1);
$bar->setRequires([new Link('hostnet/bar', 'hostnet/foo')]);
$foo->setSuggests(['hostnet/foobar' => 'Very useless text...']);
return [[[]], [[$requires_external]], [[$foo], ['hostnet/foo' => []], ['hostnet/foo' => []]], [[$foo, $bar, $foobar], ['hostnet/foo' => [$foobar], 'hostnet/bar' => [$foo]], ['hostnet/foo' => [$bar], 'hostnet/bar' => []]]];
}
示例13: getInstalledPackages
public function getInstalledPackages()
{
$fooPackage = new Package('acme/foo-bundle', 'dev-master', '9999999-dev');
$fooPackage->setAutoload(array('psr-0' => array('Acme\\FooBundle' => '')));
$fooPackage->setType('symfony-bundle');
$barPackage = new Package('acme/bar-bundle', 'dev-master', '9999999-dev');
$barPackage->setAutoload(array('psr-0' => array('Acme\\BarBundle' => 'src/')));
$barPackage->setType('symfony-bundle');
$fooBarPackage = new Package('acme/foobar-bundle', 'dev-master', '9999999-dev');
$fooBarPackage->setAutoload(array('psr-4' => array('Acme\\FooBarBundle\\' => '')));
$fooBarPackage->setType('symfony-bundle');
return array($fooPackage, $barPackage, $fooBarPackage);
}
示例14: dataGetRequired
public function dataGetRequired()
{
$package = new Package('vendor/name', '1.0.0.0', '1.0');
$link = new Link('test', 'name');
$devLink = new Link('devTest', 'name');
$package->setRequires(array($link));
$package->setDevRequires(array($devLink));
$data = array();
$data['both require false'] = array(array(), $package, false, false);
$data['require true'] = array(array($link), $package, true, false);
$data['requireDev true'] = array(array($devLink), $package, false, true);
$data['both require true'] = array(array($link, $devLink), $package, true, true);
return $data;
}
示例15: dataGetRequired
/**
* @return array
*/
public function dataGetRequired()
{
$package = new Package('vendor/name', '1.0.0.0', '1.0');
$link = new Link('test', 'name');
$devLink = new Link('devTest', 'name');
$package->setRequires([$link]);
$package->setDevRequires([$devLink]);
$data = [];
$data['both require false'] = [[], $package, false, false];
$data['require true'] = [[$link], $package, true, false];
$data['requireDev true'] = [[$devLink], $package, false, true];
$data['both require true'] = [[$link, $devLink], $package, true, true];
return $data;
}