当前位置: 首页>>代码示例>>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;未经允许,请勿转载。