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


PHP Mockery::namedMock方法代码示例

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


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

示例1: testRegisterAndChangeGrant

 public function testRegisterAndChangeGrant()
 {
     \Mockery::namedMock('FooStrategy', 'Eva\\EvaOAuth\\OAuth2\\GrantStrategy\\GrantStrategyInterface');
     $this->client->registerGrantStrategy('foo', 'FooStrategy');
     $this->client->changeGrantStrategy('foo');
     $this->assertEquals('foo', $this->client->getGrantStrategyName());
     //$this->assertInstanceOf('Eva\EvaOAuth\OAuth2\GrantStrategy\GrantStrategyInterface', $this->client->getGrantStrategy());
 }
开发者ID:assad2012,项目名称:EvaOAuth,代码行数:8,代码来源:ClientTest.php

示例2: testRegisterProvider

 public function testRegisterProvider()
 {
     \Mockery::namedMock('FooOAuth2Provider', 'Eva\\EvaOAuth\\OAuth2\\Providers\\AbstractProvider');
     \Mockery::namedMock('BarOAuth1Provider', 'Eva\\EvaOAuth\\OAuth1\\Providers\\AbstractProvider');
     Service::registerProviders(['foo' => 'FooOAuth2Provider', 'bar' => 'BarOAuth2Provider']);
     $this->assertArrayHasKey('foo', Service::getProviders());
     $this->assertArrayHasKey('bar', Service::getProviders());
     $service = new Service('foo', $this->options);
     $this->assertInstanceOf('FooOAuth2Provider', $service->getProvider());
 }
开发者ID:assad2012,项目名称:EvaOAuth,代码行数:10,代码来源:ServiceTest.php

示例3: setUp

 protected function setUp()
 {
     /** @var CacheProvider $mockCache */
     $mockCache = \Mockery::namedMock('MockCache', 'Doctrine\\Common\\Cache\\CacheProvider')->shouldReceive('fetch')->andReturn(new RequestToken('testvalue', 'testsecret'))->getMock();
     $consumer = new Consumer(['consumer_key' => 'test_consumer_key', 'consumer_secret' => 'test_consumer_secret', 'callback' => 'http://test_callback/'], $mockCache);
     $this->mockCache = $mockCache;
     $this->mock = new Mock();
     $consumer::setHttpClient(new Client());
     $httpClient = $consumer::getHttpClient();
     $this->consumer = $consumer;
     $httpClient->getEmitter()->attach($this->mock);
 }
开发者ID:assad2012,项目名称:EvaOAuth,代码行数:12,代码来源:ConsumerTest.php

示例4: itShouldThrowIfAttemptingToRedefineNamedMock

 /**
  * @test
  * @expectedException Mockery\Exception
  * @expectedExceptionMessage The mock named 'Mockery\Dave7' has been already defined with a different mock configuration
  */
 public function itShouldThrowIfAttemptingToRedefineNamedMock()
 {
     $mock = Mockery::namedMock("Mockery\\Dave7");
     $mock = Mockery::namedMock("Mockery\\Dave7", "DateTime");
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:10,代码来源:NamedMockTest.php

示例5: itCreatesConcreteMethodImplementationWithReturnType

 /** @test */
 public function itCreatesConcreteMethodImplementationWithReturnType()
 {
     $cactus = new \Nature\Plant();
     $gardener = Mockery::namedMock("NewNamespace\\ClassName", "Gardener", array('water' => true));
     $this->assertTrue($gardener->water($cactus));
 }
开发者ID:mockery,项目名称:mockery,代码行数:7,代码来源:NamedMockTest.php


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