當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mockery::spy方法代碼示例

本文整理匯總了PHP中Mockery::spy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mockery::spy方法的具體用法?PHP Mockery::spy怎麽用?PHP Mockery::spy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mockery的用法示例。


在下文中一共展示了Mockery::spy方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFindAll

 public function testFindAll()
 {
     $repository = m::spy(TranslationRepository::class);
     $service = new TranslationService($repository);
     $service->findAll([]);
     $repository->shouldHaveReceived('getByCriteria')->with([])->once();
 }
開發者ID:tectonic,項目名稱:laravel-localisation,代碼行數:7,代碼來源:TranslationServiceTest.php

示例2: testAuthorisedConsumerLanguage

 public function testAuthorisedConsumerLanguage()
 {
     $userConsumer = m::spy(ConsumerInterface::class);
     $this->consumerManager->set($userConsumer);
     $this->consumerManager->language();
     $userConsumer->shouldhaveReceived('language');
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:7,代碼來源:ConsumerManagerTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->illuminateDispatcher = m::spy('Illuminate\\Events\\Dispatcher');
     $this->logger = m::spy('Illuminate\\Log\\Writer');
     $this->dispatcher = new EventDispatcher($this->illuminateDispatcher, $this->logger);
 }
開發者ID:tectonic,項目名稱:application-support,代碼行數:7,代碼來源:EventDispatcherTest.php

示例4: it_can_accept_arbitrary_query_vars

 /**
  * @test
  */
 function it_can_accept_arbitrary_query_vars()
 {
     $query = Mockery::spy(WP_User_Query::class);
     $builder = new QueryBuilder($query);
     $builder->set('count_total', false);
     $query->shouldHaveReceived('set')->with('count_total', false);
 }
開發者ID:aaemnnosttv,項目名稱:silk,代碼行數:10,代碼來源:UserQueryBuilderTest.php

示例5: testWithCustomFieldName

 public function testWithCustomFieldName()
 {
     $mockQuery = m::spy('query');
     $filter = KeywordFilter::fromKeywords('keywords', 'title');
     $filter->applyToEloquent($mockQuery);
     $mockQuery->shouldHaveReceived('where')->with('title', 'LIKE', '%keywords%')->once();
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:7,代碼來源:KeywordFilterTest.php

示例6: testPluginsAreBooted

 public function testPluginsAreBooted()
 {
     $this->kernel->shouldReceive('getPlugins')->andReturn([$plugin1 = \Mockery::spy(PluginInterface::class), $plugin2 = \Mockery::spy(PluginInterface::class)]);
     new Application($this->kernel);
     $plugin1->shouldHaveReceived('boot')->once();
     $plugin2->shouldHaveReceived('boot')->once();
 }
開發者ID:havvg,項目名稱:psi,代碼行數:7,代碼來源:ApplicationTest.php

示例7: init

 public function init()
 {
     $this->mockManager = m::spy('Eloquence\\Behaviours\\CountCache\\CountCacheManager');
     $this->observer = new CountCacheObserver();
     $this->observer->setManager($this->mockManager);
     $this->model = new RealModelStub();
 }
開發者ID:kasoprecede47,項目名稱:eloquence,代碼行數:7,代碼來源:CountCacheObserverTest.php

示例8: setUp

 public function setUp()
 {
     $this->emitter = \Mockery::spy(Emitter::class);
     $this->event = \Mockery::mock(EventInterface::class);
     $this->message = DomainMessage::recordNow(0, 0, new Metadata(), $this->event);
     $this->eventPublishingListener = new EventPublishingListener($this->emitter);
 }
開發者ID:remi-san,項目名稱:broadway-tools,代碼行數:7,代碼來源:EventPublishingListenerTest.php

示例9: test_it_can_load_arbitrary_addons

 public function test_it_can_load_arbitrary_addons()
 {
     $stub = Mockery::spy(Addon::class);
     $repository = $this->app->make(AddonRepository::class);
     $repository->enableAddon($stub);
     $stub->shouldHaveReceived('enable')->once();
 }
開發者ID:hourglass,項目名稱:board,代碼行數:7,代碼來源:AddonInitializationTest.php

示例10: testFilterWithActiveValidAccount

 public function testFilterWithActiveValidAccount()
 {
     $mockRequest = m::spy('requestor');
     CurrentAccount::shouldReceive('determine')->once()->andReturn($this->mockAccount);
     CurrentAccount::shouldReceive('set')->once()->with($this->mockAccount);
     $this->middleware->handle($mockRequest, function () {
     });
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:8,代碼來源:AccountMiddlewareTest.php

示例11: testBuildWithCompilerPass

 public function testBuildWithCompilerPass()
 {
     $pass = \Mockery::mock('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface');
     $builder = \Mockery::spy(new ContainerBuilder());
     $this->plugin->shouldReceive('getCompilerPasses')->andReturn([$pass]);
     $this->plugin->build($builder);
     $builder->shouldHaveReceived('addCompilerPass')->once()->with($pass);
 }
開發者ID:havvg,項目名稱:psi,代碼行數:8,代碼來源:AbstractPluginTest.php

示例12: testAddNamespace

 public function testAddNamespace()
 {
     $mockFileLoader = m::spy(FileLoader::class);
     $mockRepository = m::spy(TranslationRepositoryInterface::class);
     $translationLoader = new TranslationLoader($mockFileLoader, $mockRepository);
     $translationLoader->addNamespace('shift', 'shift');
     $mockFileLoader->shouldHaveReceived('addNamespace')->once()->with('shift', 'shift');
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:8,代碼來源:TranslationLoaderTest.php

示例13: testSetsUpAssets

 public function testSetsUpAssets()
 {
     $shiftAssetContainer = m::spy('assetContainer');
     Asset::shouldReceive('container')->once()->with('shift')->andReturn($shiftAssetContainer);
     $composer = new LayoutsInstallationComposer();
     $composer->compose();
     $shiftAssetContainer->shouldHaveReceived('add')->twice();
 }
開發者ID:kamaroly,項目名稱:shift,代碼行數:8,代碼來源:LayoutsInstallationComposerTest.php

示例14: itVerifiesAMethodWasCalledWithSpecificArguments

 /**
  * @test
  */
 public function itVerifiesAMethodWasCalledWithSpecificArguments()
 {
     $spy = m::spy();
     $spy->myMethod(123, "a string");
     $spy->shouldHaveReceived("myMethod")->with(123, "a string");
     $spy->shouldHaveReceived("myMethod", array(123, "a string"));
     $this->setExpectedException("Mockery\\Exception\\InvalidCountException");
     $spy->shouldHaveReceived("myMethod")->with(123);
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:12,代碼來源:SpyTest.php

示例15: testEventTriggered

 public function testEventTriggered()
 {
     $event = \Mockery::mock('Havvg\\Component\\Lifecycle\\Event\\EventInterface');
     $provider = \Mockery::mock('Havvg\\Component\\Lifecycle\\Event\\EventProviderInterface');
     $processor = \Mockery::spy('Havvg\\Component\\Lifecycle\\Event\\EventProcessorInterface');
     $lifecycle = new Lifecycle($provider, $processor);
     $lifecycle->onEventTriggered(new EventTriggeredEvent($event));
     $processor->shouldHaveReceived('process')->once()->with($event);
 }
開發者ID:havvg,項目名稱:lifecycle,代碼行數:9,代碼來源:LifecycleTest.php


注:本文中的Mockery::spy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。