当前位置: 首页>>代码示例>>PHP>>正文


PHP Composer::setPackage方法代码示例

本文整理汇总了PHP中Composer\Composer::setPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP Composer::setPackage方法的具体用法?PHP Composer::setPackage怎么用?PHP Composer::setPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Composer的用法示例。


在下文中一共展示了Composer::setPackage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Runs the project configurator.
  *
  * @return void
  */
 public function run()
 {
     $namespace = $this->ask('Namespace', function ($namespace) {
         return $this->validateNamespace($namespace);
     }, 'App');
     $packageName = $this->ask('Package name', function ($packageName) {
         return $this->validatePackageName($packageName);
     }, $this->suggestPackageName($namespace));
     $license = $this->ask('License', function ($license) {
         return trim($license);
     }, 'proprietary');
     $description = $this->ask('Description', function ($description) {
         return trim($description);
     }, '');
     $file = new JsonFile('./composer.json');
     $config = $file->read();
     $config['name'] = $packageName;
     $config['license'] = $license;
     $config['description'] = $description;
     $config['autoload']['psr-4'] = [$namespace . '\\' => 'src/'];
     $config['autoload-dev']['psr-4'] = [$namespace . '\\Tests\\' => 'tests/'];
     unset($config['scripts']['post-root-package-install']);
     $config['extra']['branch-alias']['dev-master'] = '1.0-dev';
     $file->write($config);
     $this->composer->setPackage(Factory::create($this->io, null, true)->getPackage());
     // reload root package
     $filesystem = new Filesystem();
     $filesystem->removeDirectory('./app/Distribution');
 }
开发者ID:gerryvdm,项目名称:symfony-skeleton,代码行数:34,代码来源:ProjectConfigurator.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->io = new BufferIO();
     $this->composer = new Composer();
     $this->composer->setPackage(new RootPackage('my/project', '1.0.0', '1.0.0'));
     $this->composer->setPluginManager(new PluginManager($this->io, $this->composer));
     $this->composer->setEventDispatcher(new EventDispatcher($this->composer, $this->io));
 }
开发者ID:e-tipalchuk,项目名称:composer-changelogs,代码行数:11,代码来源:ChangelogsPluginTest.php

示例3: setUp

 public function setUp()
 {
     $this->plugin = $this->getMock('\\ContaoCommunityAlliance\\Composer\\Plugin\\Plugin');
     $this->plugin->expects($this->any())->method('getContaoRoot')->will($this->returnValue('CONTAO_ROOT'));
     $package = new RootPackage('test/me', '0.8.15', '0.8.15.0');
     $package->setType(AbstractInstaller::MODULE_TYPE);
     $this->composer = new Composer();
     $this->composer->setConfig(new Config());
     $this->composer->setPackage($package);
     $this->installerStub = $this->getMockForAbstractClass('\\ContaoCommunityAlliance\\Composer\\Plugin\\AbstractInstaller', array(new NullIO(), $this->composer, $this->plugin));
 }
开发者ID:Jobu,项目名称:core,代码行数:11,代码来源:GetSourcesSpecTest.php

示例4: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->localConfigPath = realpath(__DIR__ . '/../fixtures/local');
     $this->globalConfigPath = realpath(__DIR__ . '/../fixtures/home');
     $this->config = new Config(false, $this->localConfigPath);
     $this->config->merge(['config' => ['home' => $this->globalConfigPath]]);
     $package = new RootPackage('my/project', '1.0.0', '1.0.0');
     $package->setExtra(['my-local-config' => ['foo' => 'bar']]);
     $this->composer = new Composer();
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($package);
     $this->SUT = new ConfigLocator($this->composer);
 }
开发者ID:pyrech,项目名称:composer-changelogs,代码行数:16,代码来源:ConfigLocatorTest.php

示例5: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->tempDir = __DIR__ . '/temp';
     $this->config = new Config(false, realpath(__DIR__ . '/fixtures/local'));
     $this->config->merge(['config' => ['home' => __DIR__]]);
     $this->io = new BufferIO();
     $this->composer = new Composer();
     $this->composer->setConfig($this->config);
     $this->composer->setPackage(new RootPackage('my/project', '1.0.0', '1.0.0'));
     $this->composer->setPluginManager(new PluginManager($this->io, $this->composer));
     $this->composer->setEventDispatcher(new EventDispatcher($this->composer, $this->io));
     self::cleanTempDir();
     mkdir($this->tempDir);
 }
开发者ID:pyrech,项目名称:composer-changelogs,代码行数:17,代码来源:ChangelogsPluginTest.php

示例6: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->composer = new Composer();
     $config = new Config();
     $this->composer->setConfig($config);
     /** @var RootPackageInterface|\PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $package->expects($this->any())->method('getExtra')->willReturn(array(SharedPackageInstaller::PACKAGE_TYPE => array('vendor-dir' => sys_get_temp_dir() . '/composer-test-vendor-shared')));
     $this->composer->setPackage($package);
     $this->im = $this->getMock('Composer\\Installer\\InstallationManager');
     $this->composer->setInstallationManager($this->im);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:17,代码来源:SharedPackagePluginTest.php

示例7: setUp

 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-composer-plugin', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->config = new Config(false, $this->tempDir);
     $this->config->merge(array('config' => array('vendor-dir' => 'the-vendor')));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('getInstallPath')->will($this->returnCallback(array($this, 'getInstallPath')));
     $this->rootPackage = new RootPackage('vendor/root', '1.0', '1.0');
     $this->rootPackage->setRequires(array('vendor/package1' => new Link('vendor/root', 'vendor/package1'), 'vendor/package2' => new Link('vendor/root', 'vendor/package2')));
     $this->localRepository = new TestLocalRepository(array(new Package('vendor/package1', '1.0', '1.0'), new Package('vendor/package2', '1.0', '1.0')));
     $this->repositoryManager = new RepositoryManager($this->io, $this->config);
     $this->repositoryManager->setLocalRepository($this->localRepository);
     $this->installPaths = array();
     $this->composer = new Composer();
     $this->composer->setRepositoryManager($this->repositoryManager);
     $this->composer->setInstallationManager($this->installationManager);
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($this->rootPackage);
     $this->puliRunner = $this->getMockBuilder('Puli\\ComposerPlugin\\PuliRunner')->disableOriginalConstructor()->getMock();
     $this->previousWd = getcwd();
     chdir($this->tempDir);
     $this->plugin = new PuliPlugin($this->puliRunner);
 }
开发者ID:kormik,项目名称:composer-plugin,代码行数:26,代码来源:PuliPluginTest.php

示例8: setUp

 protected function setUp()
 {
     while (false === mkdir($this->tempDir = sys_get_temp_dir() . '/puli-plugin/PuliPluginTest_root' . rand(10000, 99999), 0777, true)) {
     }
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->config = new Config(false, $this->tempDir);
     $this->config->merge(array('config' => array('vendor-dir' => 'the-vendor')));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('getInstallPath')->will($this->returnCallback(array($this, 'getInstallPath')));
     $this->rootPackage = new RootPackage('vendor/root', '1.0', '1.0');
     $this->localRepository = new TestLocalRepository(array(new Package('vendor/package1', '1.0', '1.0'), new Package('vendor/package2', '1.0', '1.0')));
     $this->repositoryManager = new RepositoryManager($this->io, $this->config);
     $this->repositoryManager->setLocalRepository($this->localRepository);
     $this->installPaths = array();
     $this->composer = new Composer();
     $this->composer->setRepositoryManager($this->repositoryManager);
     $this->composer->setInstallationManager($this->installationManager);
     $this->composer->setConfig($this->config);
     $this->composer->setPackage($this->rootPackage);
     $this->puliRunner = $this->getMockBuilder('Puli\\ComposerPlugin\\PuliRunner')->disableOriginalConstructor()->getMock();
     $this->previousWd = getcwd();
     chdir($this->tempDir);
     $this->plugin = new PuliPlugin($this->puliRunner);
 }
开发者ID:niklongstone,项目名称:composer-plugin,代码行数:26,代码来源:PuliPluginTest.php

示例9: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fs = new SymlinkFilesystem();
     $this->composer = new Composer();
     $composerConfig = new Config();
     $this->composer->setConfig($composerConfig);
     $this->im = $this->getMock('Composer\\Installer\\InstallationManager');
     $this->composer->setInstallationManager($this->im);
     $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-bin';
     $this->ensureDirectoryExistsAndClear($this->binDir);
     $this->dependenciesDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-dependencies';
     $this->ensureDirectoryExistsAndClear($this->dependenciesDir);
     $this->symlinkDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor-shared';
     $composerConfig->merge(array('config' => array('vendor-dir' => $this->vendorDir, 'bin-dir' => $this->binDir)));
     $this->dm = $this->getMockBuilder('Composer\\Downloader\\DownloadManager')->disableOriginalConstructor()->getMock();
     $this->composer->setDownloadManager($this->dm);
     $extraConfig = array(SharedPackageInstaller::PACKAGE_TYPE => array('vendor-dir' => $this->dependenciesDir, 'symlink-dir' => $this->symlinkDir));
     /** @var RootPackage|\PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $package->expects($this->any())->method('getExtra')->willReturn($extraConfig);
     $this->composer->setPackage($package);
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
     $this->dataManager = $this->getMockBuilder('LEtudiant\\Composer\\Data\\Package\\SharedPackageDataManager')->disableOriginalConstructor()->getMock();
     $vendorDirParams = explode(DIRECTORY_SEPARATOR, $this->vendorDir);
     $this->config = new SharedPackageInstallerConfig(end($vendorDirParams), $this->vendorDir, $extraConfig);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:33,代码来源:SharedPackageInstallerTest.php

示例10: testInstall

 public function testInstall()
 {
     /* @var RootPackageInterface $rootPackage */
     $rootPackage = $this->createRootPackageMock();
     /* @var IOInterface $io */
     $io = $this->io;
     /* @var AssetTypeInterface $type */
     $type = $this->type;
     $vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test' . DIRECTORY_SEPARATOR . 'vendor';
     $this->composer->setPackage($rootPackage);
     $dm = $this->getMockBuilder('Composer\\Downloader\\DownloadManager')->disableOriginalConstructor()->getMock();
     $this->composer->expects($this->any())->method('getDownloadManager')->will($this->returnValue($dm));
     $library = new AssetInstaller($io, $this->composer, $type);
     /* @var \PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->createPackageMock('foo-asset/package');
     /* @var PackageInterface $package */
     $packageDir = $vendorDir . '/' . $package->getPrettyName();
     $dm->expects($this->once())->method('download')->with($package, $vendorDir . DIRECTORY_SEPARATOR . 'foo-asset/package');
     $repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $repository->expects($this->once())->method('addPackage')->with($package);
     /* @var InstalledRepositoryInterface $repository */
     $library->install($repository, $package);
     $this->assertFileExists($vendorDir, 'Vendor dir should be created');
     $this->ensureDirectoryExistsAndClear($packageDir);
 }
开发者ID:MvegaR,项目名称:ingSotfware,代码行数:25,代码来源:AssetInstallerTest.php

示例11: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->vendorDir = sys_get_temp_dir() . '/composer-test-vendor-shared';
     if (!is_dir($this->vendorDir)) {
         if (!mkdir($this->vendorDir)) {
             throw new \RuntimeException('Cannot create the temporary vendor dir');
         }
     } else {
         $this->clearPackageData();
     }
     $this->composer = new Composer();
     /** @var RootPackageInterface|\PHPUnit_Framework_MockObject_MockObject $rootPackage */
     $this->rootPackage = $this->getMock('Composer\\Package\\RootPackageInterface');
     $this->composer->setPackage($this->rootPackage);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:19,代码来源:SharedPackageDataManagerTest.php

示例12: testGetInstallPathWithTargetDir

    public function testGetInstallPathWithTargetDir()
    {
        /* @var RootPackageInterface $rootPackage */
        $rootPackage = $this->createRootPackageMock();
        /* @var IOInterface $io */
        $io = $this->io;
        /* @var AssetTypeInterface $type */
        $type = $this->type;

        $this->composer->setPackage($rootPackage);

        $library = new BowerInstaller($io, $this->composer, $type);
        $package = $this->createPackageMock();

        /* @var \PHPUnit_Framework_MockObject_MockObject $package */
        $package
            ->expects($this->once())
            ->method('getTargetDir')
            ->will($this->returnValue('Some/Namespace'));
        $package
            ->expects($this->any())
            ->method('getPrettyName')
            ->will($this->returnValue('foo-asset/bar'));

        /* @var PackageInterface $package */
        $exceptDir = $this->vendorDir.'/'.$package->getPrettyName().'/Some/Namespace';
        $exceptDir = str_replace('\\', '/', $exceptDir);
        $packageDir = $library->getInstallPath($package);
        $packageDir = str_replace('\\', '/', $packageDir);

        $this->assertEquals($exceptDir, $packageDir);
    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:32,代码来源:BowerInstallerTest.php

示例13: testSetGetPackage

 public function testSetGetPackage()
 {
     $composer = new Composer();
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $composer->setPackage($package);
     $this->assertSame($package, $composer->getPackage());
 }
开发者ID:alancleaver,项目名称:composer,代码行数:7,代码来源:ComposerTest.php

示例14: testGetInstallPathDoesNotReturnPathFromUnrelatedPackageThatIsConfiguredInRootPackage

 /**
  * Ensures that the installer does not use paths for other packages, which are configured
  * in the root package.
  */
 public function testGetInstallPathDoesNotReturnPathFromUnrelatedPackageThatIsConfiguredInRootPackage()
 {
     $options = array('installer-paths' => array('unrelated/package' => 'another/path'));
     $rootPackage = $this->createRootPackage($options);
     $this->composer->setPackage($rootPackage);
     $package = $this->createPackage('installer/test', array('install-path' => 'public/asset'));
     $this->assertNotEquals('another/path', $this->installer->getInstallPath($package));
 }
开发者ID:matthimatiker,项目名称:marshaller,代码行数:12,代码来源:InstallerTest.php

示例15: setUp

 /**
  * Setup.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'composer-test-vendor';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->composer = new \Composer\Composer();
     $config = new \Composer\Config();
     $this->composer->setConfig($config);
     /** @var \Composer\Package\RootPackageInterface|\PHPUnit_Framework_MockObject_MockObject $package */
     $package = $this->getMock('Composer\\Package\\RootPackageInterface');
     $package->expects($this->any())->method('getExtra')->willReturn(array(PhpCodesnifferStandardInstaller::PACKAGE_TYPE => array('vendor-dir' => $this->vendorDir)));
     $config->merge(array('config' => array('vendor-dir' => $this->vendorDir)));
     $this->composer->setPackage($package);
     $this->im = $this->getMock('Composer\\Installer\\InstallationManager');
     $this->composer->setInstallationManager($this->im);
     $this->io = $this->getMock('Composer\\IO\\IOInterface');
 }
开发者ID:sseidelmann,项目名称:CodesnifferInstaller,代码行数:20,代码来源:PhpCodesnifferStandardInstallerTest.php


注:本文中的Composer\Composer::setPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。