コード例 #1
0
ファイル: ClientTest.php プロジェクト: assad2012/EvaOAuth
 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
0
ファイル: ServiceTest.php プロジェクト: assad2012/EvaOAuth
 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
0
ファイル: ConsumerTest.php プロジェクト: assad2012/EvaOAuth
 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
0
ファイル: NamedMockTest.php プロジェクト: qasem2rubik/laravel
 /**
  * @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
0
ファイル: NamedMockTest.php プロジェクト: mockery/mockery
 /** @test */
 public function itCreatesConcreteMethodImplementationWithReturnType()
 {
     $cactus = new \Nature\Plant();
     $gardener = Mockery::namedMock("NewNamespace\\ClassName", "Gardener", array('water' => true));
     $this->assertTrue($gardener->water($cactus));
 }