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


PHP Composer::expects方法代码示例

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


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

示例1: setUp

    public function setUp()
    {
        $this->config = $this->getMock('Composer\Config');
        $this->config->expects($this->any())
            ->method('get')
            ->will($this->returnCallback(function ($key) {
                switch ($key) {
                    case 'cache-repo-dir':
                        return sys_get_temp_dir() . '/composer-test-repo-cache';
                    case 'vendor-dir':
                        return sys_get_temp_dir() . '/composer-test/vendor';
                }

                return null;
            }));

        $this->rootPackage = $this->getMock('Composer\Package\RootPackageInterface');
        $this->package = $this->getMock('Composer\Package\PackageInterface');
        $this->package->expects($this->any())
            ->method('getName')
            ->will($this->returnValue('foo-asset/foo'));

        $this->composer = $this->getMock('Composer\Composer');
        $this->composer->expects($this->any())
            ->method('getPackage')
            ->will($this->returnValue($this->rootPackage));
        $this->composer->expects($this->any())
            ->method('getConfig')
            ->will($this->returnValue($this->config));
    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:30,代码来源:IgnoreFactoryTest.php

示例2: testIsMagentoRoot

 /**
  * @param string $packageName
  * @param boolean $expected
  * @dataProvider isMagentoRootDataProvider
  */
 public function testIsMagentoRoot($packageName, $expected)
 {
     $rootPackageMock = $this->getMockForAbstractClass(\Composer\Package\RootPackageInterface::class);
     $this->composerMock->expects($this->once())->method('getPackage')->willReturn($rootPackageMock);
     $rootPackageMock->method('getName')->willReturn($packageName);
     $this->assertEquals($expected, $this->composerInformation->isMagentoRoot());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:ComposerInformationTest.php

示例3: testActivate

 /**
  * All we can do is confirm that the plugin tried to register the
  * correct installer class during ::activate().
  *
  * @return void
  */
 public function testActivate()
 {
     $this->composer = $this->getMock('Composer\\Composer', ['getInstallationManager', 'addInstaller']);
     $this->composer->setConfig(new Config(false));
     $this->composer->expects($this->once())->method('getInstallationManager')->will($this->returnSelf());
     $this->composer->expects($this->once())->method('addInstaller')->with($this->isInstanceOf('Loadsys\\Composer\\PuphpetReleaseInstaller'));
     $this->plugin->activate($this->composer, $this->io);
 }
开发者ID:loadsys,项目名称:puphpet-release-composer-installer,代码行数:14,代码来源:PuphpetReleaseInstallerPluginTest.php

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

示例5: testWillDeleteExistingTagfile

 public function testWillDeleteExistingTagfile()
 {
     touch($this->testTempDir . '/tags');
     $this->assertFileExists($this->testTempDir . '/tags');
     $this->composerMock->expects($this->once())->method('getConfig')->will($this->returnValue($this->composerConfig));
     Ctagger::setTagsDir($this->testTempDir);
     Ctagger::ctag($this->event);
 }
开发者ID:jeremykendall,项目名称:phpctagger,代码行数:8,代码来源:CtaggerTest.php

示例6: setUp

 public function setUp()
 {
     $this->composer = $this->getMockBuilder('Composer\\Composer')->getMock();
     $this->io = $this->getMockBuilder('Composer\\IO\\IOInterface')->getMock();
     $this->package = $this->getMockBuilder('Composer\\Package\\PackageInterface')->getMock();
     $config = $this->getMockBuilder('Composer\\Config')->getMock();
     $config->expects($this->any())->method('get')->will($this->returnCallback(function ($key) {
         $val = null;
         switch ($key) {
             case 'cache-repo-dir':
                 return sys_get_temp_dir() . '/composer-test-repo-cache';
             case 'vendor-dir':
                 return sys_get_temp_dir() . '/composer-test/vendor';
         }
         return $val;
     }));
     $rootPackage = $this->getMockBuilder('Composer\\Package\\RootPackageInterface')->getMock();
     $this->composer->expects($this->any())->method('getConfig')->will($this->returnValue($config));
     $this->composer->expects($this->any())->method('getPackage')->will($this->returnValue($rootPackage));
 }
开发者ID:stefangr,项目名称:composer-asset-plugin,代码行数:20,代码来源:ScriptHandlerTest.php

示例7: testIgnoredBundles

 public function testIgnoredBundles()
 {
     $packages = array($this->createPackage('foo/foo-bundle', 'symfony-bundle', array('psr-0' => array('Acme\\FooBundle' => ''))), $this->createPackage('acme/library-bundle', 'symfony-bundle', array('psr-0' => array('Acme\\LibraryBundle' => ''))));
     $rootPackage = new RootPackage('DemoPackage', 'dev-master', '1.x-dev');
     $rootPackage->setExtra(array('checkbundles-ignore' => array('Acme\\LibraryBundle\\AcmeLibraryBundle')));
     $this->composerMock->expects($this->any())->method('getPackage')->will($this->returnValue($rootPackage));
     $this->localRepository->expects($this->any())->method('getPackages')->will($this->returnValue($packages));
     $kernelHelper = $this->getMockBuilder('WillemJan\\Util\\KernelHelper')->disableOriginalConstructor()->setMethods(array('getBundlesForKernels'))->getMock();
     $kernelHelper->expects($this->any())->method('getBundlesForKernels')->will($this->returnValue(array('Acme\\FooBundle\\AcmeFooBundle')));
     $composerHelper = $this->getMockBuilder('WillemJan\\CheckBundles\\Util\\ComposerHelper')->setConstructorArgs(array($this->composerMock))->setMethods(array('getInstalledRepository', 'findBundleFiles'))->getMock();
     $composerHelper->expects($this->any())->method('findBundleFiles')->will($this->returnCallback(function ($package) use($packages) {
         switch ($package->getName()) {
             case 'foo/foo-bundle':
                 return array('AcmeFooBundle.php');
                 break;
             case 'acme/library-bundle':
                 return array('AcmeLibraryBundle.php');
                 break;
         }
         return array('ShouldNotHappenBundle.php');
     }));
     $composerHelper->expects($this->any())->method('getInstalledRepository')->will($this->returnValue($this->localRepository));
     $this->assertEquals(array(), $composerHelper->getNonActiveSymfonyBundles($kernelHelper->getBundlesForKernels()));
 }
开发者ID:frogriotcom,项目名称:CheckBundles,代码行数:24,代码来源:ComposerHelperTest.php

示例8: testGetPackageVersionsFailed

 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage We cannot retrieve information on magento/product-community-edition.
  */
 public function testGetPackageVersionsFailed()
 {
     $communityPackage = $this->getMock('\\Composer\\Package\\Package', [], [], '', false);
     $enterprisePackage = $this->getMock('\\Composer\\Package\\Package', [], [], '', false);
     $communityPackage->expects($this->once())->method('getName')->willReturn('magento/product-community-edition');
     $enterprisePackage->expects($this->once())->method('getName')->willReturn('magento/product-enterprise-edition');
     $this->composerInformation->expects($this->any())->method('isSystemPackage')->willReturn(true);
     $this->composerInformation->expects($this->once())->method('isPackageInComposerJson')->willReturn(true);
     $this->repository->expects($this->once())->method('getPackages')->willReturn([$communityPackage, $enterprisePackage]);
     $this->locker->expects($this->once())->method('getLockedRepository')->willReturn($this->repository);
     $this->composer->expects($this->once())->method('getLocker')->willReturn($this->locker);
     $this->magentoComposerApp->expects($this->once())->method('createComposer')->willReturn($this->composer);
     $this->composerAppFactory->expects($this->once())->method('create')->willReturn($this->magentoComposerApp);
     $this->composerAppFactory->expects($this->once())->method('createInfoCommand')->willReturn($this->infoCommand);
     $this->systemPackage = new SystemPackage($this->composerAppFactory, $this->composerInformation);
     $this->infoCommand->expects($this->once())->method('run')->with('magento/product-community-edition')->willReturn(false);
     $this->systemPackage->getPackageVersions();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:22,代码来源:SystemPackageTest.php

示例9: getRootPackage

 protected function getRootPackage()
 {
     $this->event_command->expects($this->once())->method('getComposer')->will($this->returnValue($this->composer));
     $this->composer->expects($this->once())->method('getPackage')->will($this->returnValue($this->package));
 }
开发者ID:anime-db,项目名称:anime-db,代码行数:5,代码来源:ScriptHandlerTest.php


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