@@ -66,7 +66,6 @@ public function testPublicRepositoryWithComposer($type, $filename)
66
66
{
67
67
$ repoBaseUrl = 'https://bitbucket.org/composer-test/repo-name ' ;
68
68
$ repoUrl = $ repoBaseUrl .'.git ' ;
69
- $ repoApiUrl = 'https://api.bitbucket.org/1.0/repositories/composer-test/repo-name ' ;
70
69
$ identifier = 'v0.0.0 ' ;
71
70
$ sha = 'SOMESHA ' ;
72
71
@@ -79,19 +78,30 @@ public function testPublicRepositoryWithComposer($type, $filename)
79
78
->setConstructorArgs (array ($ io ))
80
79
->getMock ();
81
80
82
- $ remoteFilesystem ->expects ($ this ->at (0 ))
83
- ->method ('getContents ' )
84
- ->with ($ this ->equalTo ('bitbucket.org ' ), $ this ->equalTo ($ this ->getScheme ($ repoApiUrl )), $ this ->equalTo (false ))
85
- ->will ($ this ->returnValue ($ this ->createJsonComposer (array ('main_branch ' => 'test_master ' ))));
86
-
87
- $ remoteFilesystem ->expects ($ this ->at (1 ))
81
+ $ remoteFilesystem ->expects ($ this ->any ())
88
82
->method ('getContents ' )
89
- ->with (
90
- $ this ->equalTo ('bitbucket.org ' ),
91
- $ this ->equalTo ($ repoApiUrl .'/src/ ' .$ identifier .'/ ' .$ filename ),
92
- $ this ->equalTo (false )
83
+ ->withConsecutive (
84
+ array (
85
+ 'bitbucket.org ' ,
86
+ 'https://api.bitbucket.org/2.0/repositories/composer-test/repo-name?fields=-project%2C-owner ' ,
87
+ false ,
88
+ ),
89
+ array (
90
+ 'bitbucket.org ' ,
91
+ 'https://api.bitbucket.org/1.0/repositories/composer-test/repo-name/main-branch ' ,
92
+ false ,
93
+ ),
94
+ array (
95
+ 'bitbucket.org ' ,
96
+ 'https://api.bitbucket.org/1.0/repositories/composer-test/repo-name/src/v0.0.0/ ' .$ filename ,
97
+ false ,
98
+ )
93
99
)
94
- ->will ($ this ->returnValue ($ this ->createApiJsonWithRepoData (array ())));
100
+ ->willReturnOnConsecutiveCalls (
101
+ '{"scm":"git","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/composer-test\/repo-name\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/composer-test\/repo-name\/refs\/tags"},"clone":[{"href":"https:\/\/[email protected] \/composer-test\/repo-name.git","name":"https"},{"href":"ssh:\/\/[email protected] \/composer-test\/repo-name.git","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/composer-test\/repo-name"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false} ' ,
102
+ '{"name": "test_master"} ' ,
103
+ '{"name": "composer-test/repo-name","description": "test repo","license": "GPL","authors": [{"name": "Name","email": "[email protected] "}],"require": {"creator/package": "^1.0"},"require-dev": {"phpunit/phpunit": "~4.8"}} '
104
+ );
95
105
96
106
$ repoConfig = array (
97
107
'url ' => $ repoUrl ,
@@ -104,7 +114,6 @@ public function testPublicRepositoryWithComposer($type, $filename)
104
114
105
115
$ driver = new GitBitbucketDriver ($ repoConfig , $ io , $ this ->config , null , $ remoteFilesystem );
106
116
$ driver ->initialize ();
107
- $ this ->setAttribute ($ driver , 'tags ' , array ($ identifier => $ sha ));
108
117
109
118
$ this ->assertEquals ('test_master ' , $ driver ->getRootIdentifier ());
110
119
0 commit comments