浏览代码

Fix tests when openssl is disabled

Jordi Boggiano 13 年之前
父节点
当前提交
2249dd0548
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. 13 7
      tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php

+ 13 - 7
tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php

@@ -23,8 +23,10 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 {
     public function testPrivateRepository()
     {
+        $scheme = extension_loaded('openssl') ? 'https' : 'http';
+
         $repoUrl = 'http://github.com/composer/packagist';
-        $repoApiUrl = 'https://api.github.com/repos/composer/packagist';
+        $repoApiUrl = $scheme.'://api.github.com/repos/composer/packagist';
         $repoSshUrl = 'git@github.com:composer/packagist.git';
         $identifier = 'v0.0.0';
         $sha = 'SOMESHA';
@@ -70,7 +72,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
         $dist = $gitHubDriver->getDist($identifier);
         $this->assertEquals('zip', $dist['type']);
-        $this->assertEquals('https://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
+        $this->assertEquals($scheme.'://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
         $this->assertEquals('v0.0.0', $dist['reference']);
 
         $source = $gitHubDriver->getSource($identifier);
@@ -80,7 +82,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
         $dist = $gitHubDriver->getDist($sha);
         $this->assertEquals('zip', $dist['type']);
-        $this->assertEquals('https://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
+        $this->assertEquals($scheme.'://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
         $this->assertEquals('v0.0.0', $dist['reference']);
 
         $source = $gitHubDriver->getSource($sha);
@@ -91,8 +93,10 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
     public function testPublicRepository()
     {
+        $scheme = extension_loaded('openssl') ? 'https' : 'http';
+
         $repoUrl = 'http://github.com/composer/packagist';
-        $repoApiUrl = 'https://api.github.com/repos/composer/packagist';
+        $repoApiUrl = $scheme.'://api.github.com/repos/composer/packagist';
         $identifier = 'v0.0.0';
         $sha = 'SOMESHA';
 
@@ -118,7 +122,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
         $dist = $gitHubDriver->getDist($identifier);
         $this->assertEquals('zip', $dist['type']);
-        $this->assertEquals('https://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
+        $this->assertEquals($scheme.'://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
         $this->assertEquals($identifier, $dist['reference']);
 
         $source = $gitHubDriver->getSource($identifier);
@@ -128,7 +132,7 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
         $dist = $gitHubDriver->getDist($sha);
         $this->assertEquals('zip', $dist['type']);
-        $this->assertEquals('https://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
+        $this->assertEquals($scheme.'://github.com/composer/packagist/zipball/v0.0.0', $dist['url']);
         $this->assertEquals($identifier, $dist['reference']);
 
         $source = $gitHubDriver->getSource($sha);
@@ -139,8 +143,10 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
 
     public function testPrivateRepositoryNoInteraction()
     {
+        $scheme = extension_loaded('openssl') ? 'https' : 'http';
+
         $repoUrl = 'http://github.com/composer/packagist';
-        $repoApiUrl = 'https://api.github.com/repos/composer/packagist';
+        $repoApiUrl = $scheme.'://api.github.com/repos/composer/packagist';
         $repoSshUrl = 'git@github.com:composer/packagist.git';
         $identifier = 'v0.0.0';
         $sha = 'SOMESHA';