本文整理汇总了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());
}
示例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());
}
示例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);
}
示例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");
}
示例5: itCreatesConcreteMethodImplementationWithReturnType
/** @test */
public function itCreatesConcreteMethodImplementationWithReturnType()
{
$cactus = new \Nature\Plant();
$gardener = Mockery::namedMock("NewNamespace\\ClassName", "Gardener", array('water' => true));
$this->assertTrue($gardener->water($cactus));
}