Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 /**
  * @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");
 }
Ejemplo n.º 5
0
 /** @test */
 public function itCreatesConcreteMethodImplementationWithReturnType()
 {
     $cactus = new \Nature\Plant();
     $gardener = Mockery::namedMock("NewNamespace\\ClassName", "Gardener", array('water' => true));
     $this->assertTrue($gardener->water($cactus));
 }