Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jadb committed Aug 30, 2016
1 parent 9a479b7 commit 6b27800
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/TestCase/Auth/OAuthAuthenticateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,12 @@ public function testNormalizeConfig1()

public function testGetUserWithMissingOrAlteredQueryState()
{
$provider = $this->getMockBuilder('League\OAuth2\Client\Provider\Github', [], [], '', false)->getMock();
$this->oauth->config($this->oauth->normalizeConfig($this->config));
$this->oauth->config($this->oauth->config('providers.github'), false);

$provider = $this->getMockBuilder('League\OAuth2\Client\Provider\Github')
->disableOriginalConstructor()
->getMock();

$this->oauth->expects($this->any())
->method('provider')
Expand Down Expand Up @@ -296,7 +301,9 @@ public function testGetUser()
->method('toArray')
->will($this->returnValue(['login' => 'foo']));

$provider = $this->getMockBuilder('League\OAuth2\Client\Provider\Github', [], [], '', false)->getMock();
$provider = $this->getMockBuilder('League\OAuth2\Client\Provider\Github')
->disableOriginalConstructor()
->getMock();
$provider->expects($this->once())
->method('getAccessToken')
->with('authorization_code', ['code' => 'bar'])
Expand Down Expand Up @@ -354,7 +361,9 @@ public function testUnauthenticated()
$result = $oauth->unauthenticated($request, $response);
$this->assertNull($result);

$session = $this->getMockBuilder('Cake\Network\Session', ['write'])->getMock();
$session = $this->getMockBuilder('Cake\Network\Session')
->setMethods(['write'])
->getMock();
$session->expects($this->once())
->method('write')
->with('oauth2state', 'foobar');
Expand Down

0 comments on commit 6b27800

Please sign in to comment.