當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。