From 9b00713a67b8263853776fcbc67f99cec435e201 Mon Sep 17 00:00:00 2001 From: Stefan Grootscholten Date: Sat, 2 Jul 2016 17:03:01 +0200 Subject: [PATCH] Update unit test for Bitbucket util --- tests/Composer/Test/Util/BitbucketTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Util/BitbucketTest.php b/tests/Composer/Test/Util/BitbucketTest.php index 9f6cd2a5f..45b4ce752 100644 --- a/tests/Composer/Test/Util/BitbucketTest.php +++ b/tests/Composer/Test/Util/BitbucketTest.php @@ -164,10 +164,11 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase ->willReturn(sprintf('{}', $this->token)) ; + $authJson = $this->getAuthJsonMock(); $this->config - ->expects($this->exactly(2)) + ->expects($this->exactly(3)) ->method('getAuthConfigSource') - ->willReturn($this->getAuthJsonMock()) + ->willReturn($authJson) ; $this->config ->expects($this->once()) @@ -175,6 +176,20 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase ->willReturn($this->getConfJsonMock()) ; + $authJson->expects($this->once()) + ->method('addConfigSetting') + ->with( + 'bitbucket-oauth.'.$this->origin, + array( + 'consumer-key' => $this->consumer_key, + 'consumer-secret' => $this->consumer_secret + ) + ); + + $authJson->expects($this->once()) + ->method('removeConfigSetting') + ->with('http-basic.'.$this->origin); + $this->assertTrue($this->bitbucket->authorizeOAuthInteractively($this->origin, $this->message)); }