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


PHP Mockery::type方法代码示例

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


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

示例1: testNoFirewall

 public function testNoFirewall()
 {
     $this->tokenStorage->shouldReceive('getToken')->andReturnNull();
     $this->authorizationChecker->shouldNotReceive('isGranted');
     $this->accessDecisionManager->shouldReceive('decide')->once()->with(\Mockery::type('Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken'), array(PublishWorkflowChecker::VIEW_ATTRIBUTE), $this->document)->andReturn(true);
     $this->assertTrue($this->publishWorkflowChecker->isGranted(PublishWorkflowChecker::VIEW_ATTRIBUTE, $this->document));
 }
开发者ID:symfony-cmf,项目名称:core-bundle,代码行数:7,代码来源:PublishWorkflowCheckerTest.php

示例2: canWriteToOutput

 /**
  * @test
  *
  * @dataProvider logDataProvider
  *
  * @covers ::log
  *
  * @covers ::interpolate
  *
  * @param string $level
  * @param string $message
  * @param array $context [optional]
  */
 public function canWriteToOutput($level, $message, array $context = [])
 {
     $output = $this->makeOutputMock();
     $output->shouldReceive('writeln')->once()->with(m::type('string'));
     $writer = $this->makeConsoleWriter($output);
     $writer->log($level, $message, $context);
 }
开发者ID:aedart,项目名称:scaffold,代码行数:20,代码来源:ConsoleWriterTest.php

示例3: testMakePassingConfig

 public function testMakePassingConfig()
 {
     $config = ['Reports' => ['permissions' => ['isStaff'], 'url' => 'reports']];
     $menu = m::mock('App\\Http\\Composers\\NavMenuComposer[build,filter]', [$this->app['menu'], $this->config, $this->auth, $this->gate]);
     $menu->shouldReceive('build')->once()->with($config, m::type('Caffeinated\\Menus\\Builder'));
     $menu->make('Profile', $config);
 }
开发者ID:hughfletcher,项目名称:nuticket,代码行数:7,代码来源:NavMenuComposerTest.php

示例4: it_should_write_events_to_eventstore_on_flush

 /**
  * @test
  * @covers ::commit
  * @covers ::push
  */
 public function it_should_write_events_to_eventstore_on_flush()
 {
     $expectedEvents = [new WritableEvent(new UUID(), '123', [])];
     $this->eventstore->shouldReceive('writeToStream')->once()->with('streamUri', m::type(WritableEventCollection::class));
     $this->transaction->push('streamUri', $expectedEvents);
     $this->transaction->commit();
 }
开发者ID:php-in-practice,项目名称:matters-aggregate,代码行数:12,代码来源:SingleStreamTest.php

示例5: testSend

 public function testSend()
 {
     $user = m::mock();
     $user->shouldReceive('getActivationCode')->once()->andReturn('secretC0d3');
     Mail::shouldReceive('queue')->once()->with(m::type('array'), array('user' => $user, 'code' => 'secretC0d3'), m::type('closure'));
     $this->activation->send($user);
 }
开发者ID:djordje,项目名称:laravel-sentry-backend,代码行数:7,代码来源:ServicesNotifiersAccountActivationTest.php

示例6: testUpMigrationCanBePretended

 public function testUpMigrationCanBePretended()
 {
     list($migrator, $repository, $filesystem, $resolver) = $this->getMocks();
     $filesystem->shouldReceive('glob')->once()->with(__DIR__ . '/*_*.php')->andReturn(array(__DIR__ . '/2_bar.php', __DIR__ . '/1_foo.php', __DIR__ . '/3_baz.php'));
     $filesystem->shouldReceive('requireOnce')->with(__DIR__ . '/2_bar.php');
     $filesystem->shouldReceive('requireOnce')->with(__DIR__ . '/1_foo.php');
     $filesystem->shouldReceive('requireOnce')->with(__DIR__ . '/3_baz.php');
     $repository->shouldReceive('getRan')->once()->andReturn(array('1_foo'));
     $repository->shouldReceive('getNextBatchNumber')->once()->andReturn(1);
     $barMock = M::mock('stdClass');
     $barMock->shouldReceive('getConnection')->once()->andReturn(null);
     $barMock->shouldReceive('up')->once();
     $bazMock = M::mock('stdClass');
     $bazMock->shouldReceive('getConnection')->once()->andReturn(null);
     $bazMock->shouldReceive('up')->once();
     $migrator->expects($this->at(0))->method('resolve')->with($this->equalTo('2_bar'))->will($this->returnValue($barMock));
     $migrator->expects($this->at(1))->method('resolve')->with($this->equalTo('3_baz'))->will($this->returnValue($bazMock));
     $connection = M::mock('stdClass');
     $connection->shouldReceive('pretend')->with(M::type('Closure'))->andReturnUsing(function ($closure) {
         $closure();
         return array(array('query' => 'foo'));
     }, function ($closure) {
         $closure();
         return array(array('query' => 'bar'));
     });
     $resolver->shouldReceive('connection')->with(null)->andReturn($connection);
     $migrator->run(__DIR__, true);
 }
开发者ID:singularity321,项目名称:Arty,代码行数:28,代码来源:MigratorTest.php

示例7: testCompilerPassesAreRegistered

 public function testCompilerPassesAreRegistered()
 {
     $container = m::mock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $container->shouldReceive('addCompilerPass')->once()->with(m::type('Dpn\\XmlSitemapBundle\\DependencyInjection\\Compiler\\GeneratorCompilerPass'));
     $bundle = new DpnXmlSitemapBundle();
     $bundle->build($container);
 }
开发者ID:bitundpixel,项目名称:DpnXmlSitemapBundle,代码行数:7,代码来源:DpnXmlSitemapBundleTest.php

示例8: testAddFilterFromValidator

 public function testAddFilterFromValidator()
 {
     $router = m::mock('Illuminate\\Routing\\Router');
     $router->shouldReceive('addFilter')->once()->with('validator.login', m::type('Closure'));
     $factory = new Factory($this->request, m::mock('Illuminate\\Validation\\Factory'), $router);
     $factory->add('login', 'ValidatorStub2');
 }
开发者ID:bigelephant,项目名称:input-validator,代码行数:7,代码来源:TestFactory.php

示例9: testLoadsServiceProvider

 public function testLoadsServiceProvider()
 {
     $container = Mockery::mock('League\\Container\\Container');
     $container->shouldReceive('delegate')->once();
     $container->shouldReceive('addServiceProvider')->once()->with(Mockery::type('Jenssegers\\Lean\\SlimServiceProvider'));
     $app = new App($container);
 }
开发者ID:jenssegers,项目名称:lean,代码行数:7,代码来源:AppTest.php

示例10: testDestroySuccessReturnsOkResponse

 public function testDestroySuccessReturnsOkResponse()
 {
     $this->mockService->shouldReceive('remove')->once()->with(m::type('integer'))->andReturn(true);
     $this->mockResponse->shouldReceive('create')->once()->with(m::type('array'))->andReturn($this->mockResponse);
     $response = $this->controller->destroy(1000);
     $this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $response);
 }
开发者ID:hownowbrowncow,项目名称:restaurant-cms,代码行数:7,代码来源:PhotosControllerTest.php

示例11: testHandle

 /**
  * A basic test example.
  *
  * @return void
  */
 public function testHandle()
 {
     // $this->expectsEvents(App\Events\ActionCreatedEvent::class, App\Events\TicketCreatedEvent::class);
     // $fetch = m::mock('App\Jobs\FetchEmailJob[getServer,getMessages,anonymousUser,createTicket,buildActions,processEmail]', [$this->email]);
     $piper = m::mock('App\\Services\\Piper\\Piper');
     $piper->shouldReceive('fetch')->once()->with(m::type('App\\Email'));
     $fetch = new FetchEmailJob($this->email);
     $fetch->handle($piper);
     // $messages = [m::mock('Fetch\Message'), m::mock('Fetch\Message'), m::mock('Fetch\Message')];
     // $server = m::mock();
     // $server->shouldReceive('getMessages')->once()->andReturn($messages);
     // $server->shouldReceive('getServerString')->once();
     // $server->shouldReceive('numMessages')->once();
     // Log::shouldReceive('debug')->once();
     // $fetch->shouldReceive('getServer')->once()->andReturn($server);
     // $fetch->shouldReceive('anonymousUser')->times(3)->andReturn(collect());
     // // $fetch->shouldReceive('getAssigned')->times(3)->andReturn(collect());
     // $fetch->shouldReceive('createTicket')->times(3)->andReturn(collect(['ticket' => m::mock('App\Ticket')]), collect());
     // $fetch->shouldReceive('buildActions')->times(3)->andReturn(collect());
     // $fetch->shouldReceive('processEmail')->times(3);
     // $parser = m::mock('App\Services\EmailParser');
     // $parser->shouldReceive('parse')->times(3)->andReturn(collect());
     // $user = m::mock('App\Contracts\Repositories\UserInterface');
     // $fetch->handle($parser, $user);
 }
开发者ID:hughfletcher,项目名称:nuticket,代码行数:30,代码来源:FetchEmailJobTest.php

示例12: testRollbackCommandCanBePretended

 public function testRollbackCommandCanBePretended()
 {
     $command = new RollbackCommand($migrator = m::mock('Illuminate\\Database\\Migrations\\Migrator'));
     $migrator->shouldReceive('setConnection')->once()->with('foo');
     $migrator->shouldReceive('rollback')->once()->with(m::type('Symfony\\Component\\Console\\Output\\OutputInterface'), true);
     $this->runCommand($command, array('--pretend' => true, '--database' => 'foo'));
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:7,代码来源:MigrationRollbackCommandTest.php

示例13: testServiceCreateNewArticleCreateArticleRepoCalled

 /**
  *  Tests if the createArticle method
  * on the repo is called.
  **/
 public function testServiceCreateNewArticleCreateArticleRepoCalled()
 {
     $fakeArticle = m::mock('Eloquent', 'App\\Models\\Article');
     $articleTitle = 'testing title';
     $this->fakeRepo->shouldReceive('createArticle')->once()->with(m::type('App\\Models\\User'), $articleTitle)->andReturn($fakeArticle);
     $this->service->createNewArticle($this->getMockUser(), $articleTitle);
 }
开发者ID:TiagoMaiaL,项目名称:wiki,代码行数:11,代码来源:ArticlesServiceUnitTest.php

示例14: testSetsHttpClient

 public function testSetsHttpClient()
 {
     $serviceFactory = Mockery::mock('OAuth\\ServiceFactory');
     $serviceFactory->shouldReceive('setHttpClient')->with(Mockery::type('OAuth\\Common\\Http\\Client\\CurlClient'))->times(1);
     $oauth = new OAuth($serviceFactory, new Memory());
     $oauth->setHttpClient('CurlClient');
 }
开发者ID:shushkins,项目名称:vk-authLaravel5,代码行数:7,代码来源:OAuthTest.php

示例15: testFireWithEmptyHostsArrayCallsError

 public function testFireWithEmptyHostsArrayCallsError()
 {
     list($arguments, $options) = $this->createArgumentsAndOptions();
     $this->setMockAwsExpectations($arguments, array());
     $this->mockCommand->shouldReceive('error')->with(m::type('string'))->once();
     $this->controller->fire($arguments, $options);
 }
开发者ID:atyagi,项目名称:laravel-aws-ssh,代码行数:7,代码来源:ElasticBeanstalkTailCommandControllerTest.php


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