本文整理汇总了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();
}
示例2: testAuthorisedConsumerLanguage
public function testAuthorisedConsumerLanguage()
{
$userConsumer = m::spy(ConsumerInterface::class);
$this->consumerManager->set($userConsumer);
$this->consumerManager->language();
$userConsumer->shouldhaveReceived('language');
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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 () {
});
}
示例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);
}
示例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');
}
示例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();
}
示例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);
}
示例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);
}