Browse Source

Update unit test for Bitbucket util

Stefan Grootscholten 8 years ago
parent
commit
9b00713a67
1 changed files with 17 additions and 2 deletions
  1. 17 2
      tests/Composer/Test/Util/BitbucketTest.php

+ 17 - 2
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));
     }