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


PHP Config::expects方法代码示例

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


在下文中一共展示了Config::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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->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:Teino1978-Corp,项目名称:Teino1978-Corp-composer,代码行数:33,代码来源:AutoloadGeneratorTest.php

示例3: testUseGlobalIncludePath

 public function testUseGlobalIncludePath()
 {
     $package = new Package('a', '1.0', '1.0');
     $package->setAutoload(array('psr-0' => array('Main\\Foo' => '', 'Main\\Bar' => '')));
     $package->setTargetDir('Main/Foo/');
     $this->repository->expects($this->once())->method('getCanonicalPackages')->will($this->returnValue(array()));
     $this->config->expects($this->at(2))->method('get')->with($this->equalTo('use-include-path'))->will($this->returnValue(true));
     $this->fs->ensureDirectoryExists($this->vendorDir . '/a');
     $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath');
     $this->assertFileEquals(__DIR__ . '/Fixtures/autoload_real_include_path.php', $this->vendorDir . '/composer/autoload_real.php');
 }
开发者ID:aminembarki,项目名称:composer,代码行数:11,代码来源:AutoloadGeneratorTest.php


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