mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
This commit is contained in:
parent
dca0a65597
commit
2dbe66ad20
3 changed files with 23 additions and 9 deletions
|
@ -31,6 +31,8 @@ class ZipDownloaderTest extends TestCase
|
|||
private $config;
|
||||
/** @var \Composer\Package\PackageInterface&\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $package;
|
||||
/** @var string */
|
||||
private $filename;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -40,6 +42,9 @@ class ZipDownloaderTest extends TestCase
|
|||
$dlConfig = $this->getMockBuilder('Composer\Config')->getMock();
|
||||
$this->httpDownloader = new HttpDownloader($this->io, $dlConfig);
|
||||
$this->package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
|
||||
$this->filename = $this->testDir.'/composer-test.zip';
|
||||
file_put_contents($this->filename, 'zip');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
|
@ -123,7 +128,7 @@ class ZipDownloaderTest extends TestCase
|
|||
->will($this->returnValue(false));
|
||||
|
||||
$this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -145,7 +150,7 @@ class ZipDownloaderTest extends TestCase
|
|||
->will($this->throwException(new \ErrorException('Not a directory')));
|
||||
|
||||
$this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -166,7 +171,7 @@ class ZipDownloaderTest extends TestCase
|
|||
->will($this->returnValue(true));
|
||||
|
||||
$this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -194,7 +199,7 @@ class ZipDownloaderTest extends TestCase
|
|||
->will($this->returnValue(\React\Promise\resolve($procMock)));
|
||||
|
||||
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -221,7 +226,7 @@ class ZipDownloaderTest extends TestCase
|
|||
->will($this->returnValue(\React\Promise\resolve($procMock)));
|
||||
|
||||
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -260,7 +265,7 @@ class ZipDownloaderTest extends TestCase
|
|||
|
||||
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
|
||||
$this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
@ -300,7 +305,7 @@ class ZipDownloaderTest extends TestCase
|
|||
|
||||
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader, null, null, null, $processExecutor);
|
||||
$this->setPrivateProperty('zipArchiveObject', $zipArchive, $downloader);
|
||||
$promise = $downloader->extract($this->package, 'testfile.zip', 'vendor/dir');
|
||||
$promise = $downloader->extract($this->package, $this->filename, 'vendor/dir');
|
||||
$this->wait($promise);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue