本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例7: active
/**
* @test
*/
public function active()
{
$this->im->expects($this->once())->method('addInstaller');
$plugin = new SharedPackagePlugin();
$plugin->activate($this->composer, $this->io);
}