本文整理汇总了PHP中Composer\Package\Package类的典型用法代码示例。如果您正苦于以下问题:PHP Package类的具体用法?PHP Package怎么用?PHP Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Package类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:brunoric,项目名称:prestissimo,代码行数:7,代码来源:ParallelDownloaderTest.php
示例2: getInstallPath
public function getInstallPath(Package $package)
{
if (isset($this->installPaths[$package->getName()])) {
return $this->installPaths[$package->getName()];
}
return $this->tempDir . '/' . basename($package->getName());
}
开发者ID:niklongstone,项目名称:composer-plugin,代码行数:7,代码来源:PuliPluginTest.php
示例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;
}
开发者ID:frogriotcom,项目名称:CheckBundles,代码行数:13,代码来源:ComposerHelperTest.php
示例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;
}
开发者ID:alancleaver,项目名称:composer,代码行数:13,代码来源:ArchiverTest.php
示例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);
}
开发者ID:lappuse,项目名称:composer-installer,代码行数:13,代码来源:ThemeInstallerTest.php
示例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);
}
开发者ID:alex-krav,项目名称:personal-page-codeigniter,代码行数:13,代码来源:CodeigniterInstallerTest.php
示例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());
}
开发者ID:rufinus,项目名称:composer,代码行数:12,代码来源:CompletePackageTest.php
示例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));
}
开发者ID:pyrech,项目名称:composer-changelogs,代码行数:8,代码来源:UninstallHandlerTest.php
示例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());
}
开发者ID:hostnet,项目名称:entity-plugin-lib,代码行数:10,代码来源:EntityPackageTest.php
示例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));
}
开发者ID:pyrech,项目名称:composer-changelogs,代码行数:10,代码来源:UpdateHandlerTest.php
示例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;
}
开发者ID:fakerino,项目名称:ods-installer,代码行数:11,代码来源:FakerinoInstaller.php
示例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' => []]]];
}
开发者ID:hostnet,项目名称:entity-plugin-lib,代码行数:11,代码来源:EntityPackageBuilderTest.php
示例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);
}
开发者ID:frogriotcom,项目名称:CheckBundles,代码行数:13,代码来源:ComposerTestCase.php
示例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;
}
开发者ID:robertgit,项目名称:satis,代码行数:14,代码来源:PackageSelectionTest.php
示例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;
}
开发者ID:composer,项目名称:satis,代码行数:17,代码来源:PackageSelectionTest.php
示例16: setUp
protected function setUp()
{
parent::setUp();
$this->composer = $this->getMock('\\Composer\\Composer');
$this->io = $this->getMock('\\Composer\\IO\\IOInterface');
$this->package = $this->getMockBuilder('\\Composer\\Package\\Package')->disableOriginalConstructor()->getMock();
// this method is called in the job that we did not test
$this->package->expects($this->any())->method('getExtra')->will($this->returnValue([]));
$this->event_command = $this->getMockBuilder('\\Composer\\Script\\Event')->disableOriginalConstructor()->getMock();
$this->event_package = $this->getMockBuilder('\\Composer\\Installer\\PackageEvent')->disableOriginalConstructor()->getMock();
$this->container = $this->getMockBuilder('\\AnimeDb\\Bundle\\AnimeDbBundle\\Composer\\Job\\Container')->disableOriginalConstructor()->getMock();
$this->default_container = ScriptHandler::getContainer();
ScriptHandler::setContainer($this->container);
$this->default_root_dir = ScriptHandler::getRootDir();
ScriptHandler::setRootDir($this->root_dir);
}
开发者ID:anime-db,项目名称:anime-db,代码行数:16,代码来源:ScriptHandlerTest.php
示例17: testInstallPath
/**
* testInstallPath
*
* @dataProvider dataForInstallPath
*/
public function testInstallPath($name, $type, $path, $expected)
{
$composer = new Composer();
$config = new Config();
$composer->setConfig($config);
$repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
$io = $this->getMock('Composer\\IO\\IOInterface');
$installer = new CustomInstaller($io, $composer);
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
$composer->setPackage($consumerPackage);
$consumerPackage->setExtra(array('custom-installer' => array($type => $path)));
$result = $installer->getInstallPath($package);
$this->assertEquals($expected, $result);
}
开发者ID:neyensp,项目名称:custom-installer,代码行数:21,代码来源:CustomInstallerTest.php
示例18: dataPackages
public function dataPackages()
{
$metapackage = new Package('vendor/name', '1.0.0.0', '1.0');
$metapackage->setType('metapackage');
$package1 = new Package('vendor/name', '1.0.0.0', '1.0');
$package2 = new Package('vendor/name', 'dev-master', 'dev-master');
$package3 = new Package('othervendor/othername', '1.0.0.0', '1.0');
$package3->setProvides(array(new Link('', 'vendor/name')));
$data = array();
$data['metapackage'] = array(true, $metapackage, array());
$data['skipDev is true, but package is not'] = array(false, $package1, array('skip-dev' => 1));
$data['skipDev is true, package isDev'] = array(true, $package2, array('skip-dev' => 1));
$data['package in whitelist'] = array(false, $package1, array('whitelist' => array('vendor/name')));
$data['package not in whitelist'] = array(true, $package1, array('whitelist' => array('othervendor/othername')));
$data['package in blacklist'] = array(true, $package1, array('blacklist' => array('vendor/name')));
$data['package not in blacklist'] = array(false, $package1, array('blacklist' => array('othervendor/othername')));
$data['package provides a virtual package in blacklist'] = array(true, $package3, array('blacklist' => array('vendor/name')));
return $data;
}
开发者ID:ausger,项目名称:satis,代码行数:19,代码来源:ArchiveBuilderHelperTest.php
示例19: testAppendCmdOutput
public function testAppendCmdOutput()
{
$io = new NullIO();
$pkg = new Package('test/test', 1, 1);
$extra = ['bash-profile-dir' => dirname(self::$file)];
$pkg->setExtra($extra);
# Is appendable?
$this->assertFileExists(self::$file);
# Pretty much the same as the internal behavior.
# This test as well tests if the tmp file setup worked out in the setup method.
$source = file_get_contents(__DIR__ . '/../ci/.wpcli_profile');
$result = file_put_contents(self::$file, $source, FILE_APPEND);
$this->assertInternalType('integer', $result);
$this->assertTrue(false !== strpos($source, file_get_contents(self::$file)));
# Make and add file, check against existing data, …
$this->assertTrue(Setup::appendCmd($io, $pkg));
# …repetitive calls do not duplicate the appended auto-complete script.
$this->assertFalse(Setup::appendCmd($io, $pkg));
}
开发者ID:wecodemore,项目名称:wp-cli-composer,代码行数:19,代码来源:Test.php
示例20: dataPackages
public function dataPackages()
{
$metapackage = new Package('vendor/name', '1.0.0.0', '1.0');
$metapackage->setType('metapackage');
$package1 = new Package('vendor/name', '1.0.0.0', '1.0');
$package2 = new Package('vendor/name', 'dev-master', 'dev-master');
$package3 = new Package('othervendor/othername', '1.0.0.0', '1.0');
$package3->setProvides([new Link('', 'vendor/name')]);
$data = [];
$data['metapackage'] = [true, $metapackage, []];
$data['skipDev is true, but package is not'] = [false, $package1, ['skip-dev' => 1]];
$data['skipDev is true, package isDev'] = [true, $package2, ['skip-dev' => 1]];
$data['package in whitelist'] = [false, $package1, ['whitelist' => ['vendor/name']]];
$data['package not in whitelist'] = [true, $package1, ['whitelist' => ['othervendor/othername']]];
$data['package in blacklist'] = [true, $package1, ['blacklist' => ['vendor/name']]];
$data['package not in blacklist'] = [false, $package1, ['blacklist' => ['othervendor/othername']]];
$data['package provides a virtual package in blacklist'] = [true, $package3, ['blacklist' => ['vendor/name']]];
return $data;
}
开发者ID:composer,项目名称:satis,代码行数:19,代码来源:ArchiveBuilderHelperTest.php
注:本文中的Composer\Package\Package类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论