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


PHP InstallationManager::expects方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->fs = new Filesystem();
     $that = $this;
     $this->workingDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'cmptest-' . md5(uniqid('', true));
     $this->fs->ensureDirectoryExists($this->workingDir);
     $this->vendorDir = $this->workingDir . DIRECTORY_SEPARATOR . 'composer-test-autoload';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->config = $this->getMock('Composer\\Config');
     $this->config->expects($this->at(0))->method('get')->with($this->equalTo('vendor-dir'))->will($this->returnCallback(function () use($that) {
         return $that->vendorDir;
     }));
     $this->config->expects($this->at(1))->method('get')->with($this->equalTo('vendor-dir'))->will($this->returnCallback(function () use($that) {
         return $that->vendorDir;
     }));
     $this->origDir = getcwd();
     chdir($this->workingDir);
     $this->im = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->im->expects($this->any())->method('getInstallPath')->will($this->returnCallback(function ($package) use($that) {
         $targetDir = $package->getTargetDir();
         return $that->vendorDir . '/' . $package->getName() . ($targetDir ? '/' . $targetDir : '');
     }));
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->eventDispatcher = $this->getMockBuilder('Composer\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock();
     $this->generator = new AutoloadGenerator($this->eventDispatcher);
 }
开发者ID:aminembarki,项目名称:composer,代码行数:26,代码来源:AutoloadGeneratorTest.php

示例2: setUp

 protected function setUp()
 {
     $this->package = $this->getMockBuilder('Composer\\Package\\RootPackageInterface')->getMock();
     $this->assetType = $this->getMockBuilder('Fxp\\Composer\\AssetPlugin\\Type\\AssetTypeInterface')->getMock();
     $versionConverter = $this->getMockBuilder('Fxp\\Composer\\AssetPlugin\\Converter\\VersionConverterInterface')->getMock();
     $versionConverter->expects($this->any())->method('convertVersion')->will($this->returnCallback(function ($value) {
         return $value;
     }));
     $this->assetType->expects($this->any())->method('getVersionConverter')->will($this->returnValue($versionConverter));
     $this->installationManager = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->installationManager->expects($this->any())->method('isPackageInstalled')->will($this->returnValue(true));
 }
开发者ID:stefangr,项目名称:composer-asset-plugin,代码行数:12,代码来源:VcsPackageFilterTest.php

示例3: 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

示例4: 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

示例5: setUp

 protected function setUp()
 {
     $this->fs = new Filesystem();
     $that = $this;
     $this->workingDir = $this->getUniqueTmpDirectory();
     $this->vendorDir = $this->workingDir . DIRECTORY_SEPARATOR . 'composer-test-autoload';
     $this->ensureDirectoryExistsAndClear($this->vendorDir);
     $this->config = $this->getMock('Composer\\Config');
     $this->configValueMap = array('vendor-dir' => function () use($that) {
         return $that->vendorDir;
     });
     $this->config->expects($this->atLeastOnce())->method('get')->will($this->returnCallback(function ($arg) use($that) {
         $ret = null;
         if (isset($that->configValueMap[$arg])) {
             $ret = $that->configValueMap[$arg];
             if (is_callable($ret)) {
                 $ret = $ret();
             }
         }
         return $ret;
     }));
     $this->origDir = getcwd();
     chdir($this->workingDir);
     $this->im = $this->getMockBuilder('Composer\\Installer\\InstallationManager')->disableOriginalConstructor()->getMock();
     $this->im->expects($this->any())->method('getInstallPath')->will($this->returnCallback(function ($package) use($that) {
         $targetDir = $package->getTargetDir();
         return $that->vendorDir . '/' . $package->getName() . ($targetDir ? '/' . $targetDir : '');
     }));
     $this->repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
     $this->eventDispatcher = $this->getMockBuilder('Composer\\EventDispatcher\\EventDispatcher')->disableOriginalConstructor()->getMock();
     $this->generator = new AutoloadGenerator($this->eventDispatcher);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:32,代码来源:AutoloadGeneratorTest.php

示例6: updateFull

 /**
  * @test
  *
  * @depends testInstallerCreationShouldNotCreateVendorDirectory
  * @depends testInstallerCreationShouldNotCreateBinDirectory
  */
 public function updateFull()
 {
     /** @var InstallationManager|\PHPUnit_Framework_MockObject_MockObject $im */
     $this->im->expects($this->once())->method('uninstall');
     $this->im->expects($this->once())->method('install');
     $installer = $this->createInstaller();
     $initial = $this->createPackageMock('letudiant/bar-foo');
     $target = $this->createPackageMock();
     $installer->update($this->repository, $initial, $target);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:16,代码来源:SharedPackageInstallerTest.php

示例7: active

 /**
  * @test
  */
 public function active()
 {
     $this->im->expects($this->once())->method('addInstaller');
     $plugin = new SharedPackagePlugin();
     $plugin->activate($this->composer, $this->io);
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:9,代码来源:SharedPackagePluginTest.php


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