Jordi Boggiano 12 年之前
父节点
当前提交
12d63b0a35
共有 1 个文件被更改,包括 10 次插入5 次删除
  1. 10 5
      tests/Composer/Test/Util/RemoteFilesystemTest.php

+ 10 - 5
tests/Composer/Test/Util/RemoteFilesystemTest.php

@@ -148,13 +148,18 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
     public function testCaptureAuthenticationParamsFromUrl()
     {
         $io = $this->getMock('Composer\IO\IOInterface');
-        $io
-        ->expects($this->once())
-        ->method('setAuthentication')
-        ;
+        $io->expects($this->once())
+            ->method('setAuthentication')
+            ->with($this->equalTo('example.com'), $this->equalTo('user'), $this->equalTo('pass'));
 
         $fs = new RemoteFilesystem($io);
-        $fs->getContents('example.com', 'http://user:pass@www.example.com/something');
+        try {
+            $fs->getContents('example.com', 'http://user:pass@www.example.com/something');
+        } catch (\Exception $e) {
+            $this->assertInstanceOf('Composer\Downloader\TransportException', $e);
+            $this->assertEquals(404, $e->getCode());
+            $this->assertContains('404 Not Found', $e->getMessage());
+        }
     }
 
     public function testGetContents()