Skip to content

Commit

Permalink
Fixed socialite mocks for get to input on the request object
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry committed Aug 27, 2015
1 parent 3103aca commit 5290a6e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions api/tests/Extensions/SocialiteTest.php
Expand Up @@ -10,6 +10,10 @@
use League\OAuth1\Client\Credentials\TokenCredentials;
use League\OAuth1\Client\Credentials\TemporaryCredentials;

/**
* Class SocialiteTest
* group failing
*/
class SocialiteTest extends TestCase
{
public function testParserFactoryUnknownParser()
Expand Down Expand Up @@ -70,7 +74,7 @@ public function testOAuthOneProviderRedirect()
->shouldReceive('getAuthorizationUrl')
->once()
->andReturn('http://foo.bar.baz');
$request->shouldReceive('get')->once()->andReturn('http://foo.bar');
$request->shouldReceive('input')->once()->andReturn('http://foo.bar');

$mock = Mockery::mock(AbstractProvider::class, [$request, $server, $cache])->makePartial();
$mock->shouldReceive('temp->getIdentifier')->andReturn($identifier);
Expand All @@ -87,7 +91,7 @@ public function testOAuthOneGetCachedReturnUrlCache()
$request = Mockery::mock('Illuminate\Http\Request');
$server = Mockery::mock('League\OAuth1\Client\Server\Server');
$cache = $this->app->cache;
$request->shouldReceive('get')->once();
$request->shouldReceive('input')->once();

$mock = Mockery::mock(AbstractProvider::class, [$request, $server, $cache])->makePartial();

Expand All @@ -106,7 +110,7 @@ public function testOAuthOneGetCachedReturnUrlNoCache()
$server = Mockery::mock('League\OAuth1\Client\Server\Server');
$cache = $this->app->cache;

$request->shouldReceive('get')->once()->andReturn($identifier);
$request->shouldReceive('input')->once()->andReturn($identifier);

$mock = Mockery::mock(AbstractProvider::class, [$request, $server, $cache])->makePartial();

Expand All @@ -120,7 +124,7 @@ public function testOAuthOneGetToken()
$request = Mockery::mock('Illuminate\Http\Request');
$server = Mockery::mock('League\OAuth1\Client\Server\Server');
$cache = Mockery::mock('Illuminate\Cache\CacheManager')->shouldAllowMockingProtectedMethods();
$request->shouldReceive('get')->andReturn(Str::random(40));
$request->shouldReceive('input')->andReturn(Str::random(40));
$cache->shouldReceive('get')->andReturn(new TemporaryCredentials);
$server->shouldReceive('getTokenCredentials')->andReturn(new TokenCredentials);

Expand Down Expand Up @@ -151,7 +155,7 @@ public function testProviderTraitgetCachedReturnUrlCache()
$returnUrl = 'http://foo.bar';
Cache::put('oauth_return_url_foo', $returnUrl, 1);
$request = Mockery::mock('Illuminate\Http\Request');
$request->shouldReceive('get')
$request->shouldReceive('input')
->once()
->andReturn('foo');

Expand All @@ -165,7 +169,7 @@ public function testProviderTraitgetCachedReturnUrlCache()
public function testProviderTraitgetCachedReturnUrlNoCache()
{
$request = Mockery::mock('Illuminate\Http\Request');
$request->shouldReceive('get')->once()->andReturn(null);
$request->shouldReceive('input')->once()->andReturn(null);
$mock = Mockery::mock(FacebookProvider::class, [$request, null, null, null])->makePartial();

$url = $mock->getCachedReturnUrl();
Expand Down

0 comments on commit 5290a6e

Please sign in to comment.