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


PHP Application::expects方法代码示例

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


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

示例1: testGetSetApplicationAndEnv

 public function testGetSetApplicationAndEnv()
 {
     $this->assertSame($this->appMock, $this->testInstance->getApplication());
     $this->appMock->expects($this->once())->method('make')->with('view')->will($this->returnValue($this->viewMock));
     $this->assertSame($this->viewMock, $this->testInstance->getEnvironment());
     $this->testInstance->setEnvironment($this->viewMock);
     $this->assertSame($this->viewMock, $this->testInstance->getEnvironment());
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:8,代码来源:ABladedCommandTest.php

示例2: testRegister

 public function testRegister()
 {
     $this->appMock->expects($this->any())->method('singleton')->will($this->returnCallback(function ($bindTo, $bound) {
         switch ($bindTo) {
             case UtilsServiceProvider::PROVIDES_META_MANAGER:
                 $this->assertTrue($bound() instanceof MetaManager);
                 break;
         }
     }));
     $this->testInstance->registering();
 }
开发者ID:laravel-commode,项目名称:utils,代码行数:11,代码来源:UtilsServiceProviderTest.php

示例3: testLaunching

 public function testLaunching()
 {
     $this->bladedManagerMock->expects($this->exactly(3))->method('registerCommandNamespace');
     $this->appMock->expects($this->any())->method('make')->will($this->returnCallback(function ($resolvable) {
         switch ($resolvable) {
             case BladedServiceProvider::PROVIDES_SERVICE:
                 return $this->bladedManagerMock;
         }
     }));
     $this->testInstance->launching();
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:11,代码来源:BladedServiceProviderTest.php

示例4: testExtend

 public function testExtend()
 {
     $commandMock = $this->getMockForAbstractClass(ABladedCommand::class, [$this->appMock]);
     $testName = uniqid();
     $methodName = uniqid('method');
     $extendCallback = function () {
     };
     $this->appMock->expects($this->any())->method('bound')->will($this->returnValue(true));
     $this->appMock->expects($this->any())->method('make')->will($this->returnValue($commandMock));
     $this->testInstance->extendCommand($testName, $methodName, $extendCallback, false);
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:11,代码来源:BladedManagerTest.php

示例5: testRegister

 public function testRegister()
 {
     $this->applicationMock->expects($this->any())->method('make')->will($this->returnCallback(function ($toMake) {
         switch ($toMake) {
             case 'request':
                 return $this->requestMock;
         }
     }));
     $this->applicationMock->expects($this->atLeastOnce())->method('resolving')->with($this->callback(function ($callable) {
         $callable(new ViewModel());
         $callable(new RequestBag());
         $callable(new FileViewModel());
         return $callable instanceof \Closure;
     }));
     $this->requestMock->expects($this->atLeastOnce())->method('only')->will($this->returnValue([]));
     $this->requestMock->expects($this->atLeastOnce())->method('all')->will($this->returnValue([]));
     $this->testInstance->registering();
 }
开发者ID:laravel-commode,项目名称:viewmodel,代码行数:18,代码来源:ViewModelServiceProviderTest.php

示例6: testLookUp

 public function testLookUp()
 {
     $this->appMock->expects($this->any())->method('make')->will($this->returnCallback(function ($make) {
         switch ($make) {
             case 'translator':
                 return $this->tranlator;
             default:
                 var_dump($make);
                 die('testLookUp');
         }
     }));
     $this->tranlator->expects($this->any())->method('trans')->will($this->returnCallback(function ($trans) {
         switch ($trans) {
             case 'validation.attributes.login':
                 return 'Login';
             case 'validation.attributes.not_existent':
                 return $trans;
         }
     }));
     $this->assertSame('Login', $this->testInstance->login);
     $this->assertSame('not_existent', $this->testInstance->not_existent);
 }
开发者ID:laravel-commode,项目名称:utils,代码行数:22,代码来源:MetaAttributesTest.php

示例7: testRegistration

 public function testRegistration()
 {
     $test = ['command' => '\\stdClass', 'command1' => '\\stdClass'];
     $this->appMock->expects($this->any())->method('singleton')->will($this->returnCallback(function ($command, $callback) use($test) {
         $commandName = str_replace($this->testInstance->getIoCRegistry() . ".", '', $command);
         $this->assertArrayHasKey($commandName, $test);
         $this->assertTrue($callback($this->appMock) instanceof $test[$commandName]);
     }));
     $this->testInstance->registerNamespaces($test);
     $this->appMock->expects($this->any())->method('make')->will($this->returnValue($this));
     $this->assertSame($this, $this->testInstance->getNamespace('command'));
     try {
         $this->testInstance->getNamespace($command = uniqid('not_existent'));
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof \UnexpectedValueException);
         $this->assertSame("Unknown blade command namespace - {$command}.", $e->getMessage());
     }
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:18,代码来源:BladedCompilerTest.php


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