本文整理汇总了PHP中Composer\IO\IOInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::expects方法的具体用法?PHP IOInterface::expects怎么用?PHP IOInterface::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\IO\IOInterface
的用法示例。
在下文中一共展示了IOInterface::expects方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aliasMapConfigIsExtractedFromDeprecatedKey
/**
* @test
*/
public function aliasMapConfigIsExtractedFromDeprecatedKey()
{
$this->packageMock->expects($this->any())->method('getExtra')->willReturn(array('helhum/class-alias-loader' => array('class-alias-maps' => array('path/map.php'))));
$this->IOMock->expects($this->once())->method('writeError');
$subject = new Config($this->packageMock, $this->IOMock);
$this->assertSame(array('path/map.php'), $subject->get('class-alias-maps'));
}
示例2: executeCommand
/**
* @param string $command
* @param bool $decorated
* @param \PHPUnit_Framework_MockObject_Matcher_Invocation|null $matcher
*/
protected function executeCommand($command, $decorated, \PHPUnit_Framework_MockObject_Matcher_Invocation $matcher = null)
{
if ($decorated) {
$command .= ' --ansi';
}
$this->io->expects($this->atLeastOnce())->method('isDecorated')->will($this->returnValue($decorated));
$this->event_command->expects($this->atLeastOnce())->method('getIO')->will($this->returnValue($this->io));
$this->container->expects($matcher ?: $this->once())->method('executeCommand')->with($command, 0);
}
示例3: testRunPostAutoloadDumpOnlyOnce
public function testRunPostAutoloadDumpOnlyOnce()
{
$listeners = $this->plugin->getSubscribedEvents();
$this->assertArrayHasKey(ScriptEvents::POST_AUTOLOAD_DUMP, $listeners);
$listener = $listeners[ScriptEvents::POST_AUTOLOAD_DUMP];
$event = new CommandEvent(ScriptEvents::POST_AUTOLOAD_DUMP, $this->composer, $this->io);
$this->io->expects($this->exactly(3))->method('write');
$this->plugin->{$listener}($event);
$this->plugin->{$listener}($event);
}
示例4: uninstallKeepSources
/**
* @test
*/
public function uninstallKeepSources()
{
$this->io->expects($this->once())->method('askConfirmation')->willReturn(false);
/** @var SymlinkFilesystem|\PHPUnit_Framework_MockObject_MockObject $filesystem */
$filesystem = $this->getMock('\\LEtudiant\\Composer\\Util\\SymlinkFilesystem');
$filesystem->expects($this->once())->method('removeSymlink')->willReturn(true);
$installer = $this->createInstaller($this->config, $filesystem);
$package = $this->createPackageMock();
$this->repository->expects($this->once())->method('removePackage')->with($package);
$this->dm->expects($this->never())->method('remove');
$this->dataManager->expects($this->once())->method('removePackageUsage')->with($package);
$installer->uninstall($this->repository, $package);
}
示例5: uninstallDevelopment
/**
* @test
*/
public function uninstallDevelopment()
{
$this->io->expects($this->once())->method('askConfirmation')->willReturn(true);
/** @var SymlinkFilesystem|\PHPUnit_Framework_MockObject_MockObject $filesystem */
$filesystem = $this->getMock('\\LEtudiant\\Composer\\Util\\SymlinkFilesystem');
$filesystem->expects($this->once())->method('removeSymlink')->willReturn(true);
$library = new SharedPackageInstaller($this->io, $this->composer, $filesystem, $this->dataManager);
$package = $this->createDevelopmentPackageMock();
$this->repository->expects($this->exactly(1))->method('hasPackage')->with($package)->will($this->onConsecutiveCalls(true, true));
$this->repository->expects($this->once())->method('removePackage')->with($package);
$this->dm->expects($this->once())->method('remove')->with($package, $this->dependenciesDir . '/letudiant/foo-bar/dev-develop');
$this->dataManager->expects($this->once())->method('removePackageUsage')->with($package);
$library->uninstall($this->repository, $package);
}
示例6: configureExpectationsFor
/**
* Helper method for setting up the the expectations for the given $credentials.
*
* @param array $credentials
*/
protected function configureExpectationsFor($credentials = array())
{
foreach ($credentials as $host => $config) {
// satisfies the requirement that credentials without a username get ignored
if (!isset($config['username'])) {
continue;
}
// satisfies the requirement that not existing passwords will default to null
if (!isset($config['password'])) {
$config['password'] = null;
}
$this->io->expects($this->at($this->idx++))->method('setAuthentication')->with($host, $config['username'], $config['password']);
$this->io->expects($this->at($this->idx++))->method('setAuthentication')->with('http://' . $host . '/packages.json', $config['username'], $config['password']);
$this->io->expects($this->at($this->idx++))->method('setAuthentication')->with('https://' . $host . '/packages.json', $config['username'], $config['password']);
}
}