예제 #1
0
 public function testReturnsExpectedUnusedPhars()
 {
     $repo = new PharRepository(new Filename(__DIR__ . '/fixtures/phars.xml'), new Directory(__DIR__ . '/fixtures'));
     $expected = [new Phar('phpunit', new Version('4.8.7'), new File(new Filename('phpunit-4.8.7.phar.dummy'), 'phpunit-4.8.7')), new Phar('phpunit', new Version('4.8.6'), new File(new Filename('phpunit-4.8.6.phar.dummy'), 'phpunit-4.8.6'))];
     $actual = $repo->getUnusedPhars();
     $this->assertEquals($expected, $actual);
 }
예제 #2
0
 /**
  * @param RequestedPhar $requestedPhar
  * @param string        $destination
  * @param bool          $makeCopy
  *
  * @return File
  * @throws DownloadFailedException
  * @throws PharRepositoryException
  * @throws VerificationFailedException
  *
  */
 public function install(RequestedPhar $requestedPhar, $destination, $makeCopy = false)
 {
     $release = $this->getRelease($requestedPhar);
     $name = $this->getPharName($release->getUrl());
     $version = $this->getPharVersion($release->getUrl());
     if (!$this->repository->hasPhar($name, $version)) {
         $phar = new Phar($name, $version, $this->downloader->download($release));
         $this->repository->addPhar($phar);
     } else {
         $phar = $this->repository->getPhar($name, $version);
     }
     $destination = $destination . '/' . $phar->getName();
     $this->installer->install($phar->getFile(), $destination, $makeCopy);
     $this->repository->addUsage($phar, $destination);
 }