2012-08-24 08:57:38 +00:00
|
|
|
<?php
|
2012-08-23 19:35:17 +00:00
|
|
|
|
2012-08-24 08:57:38 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Composer.
|
|
|
|
*
|
|
|
|
* (c) Nils Adermann <naderman@naderman.de>
|
|
|
|
* Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2012-08-27 07:33:04 +00:00
|
|
|
namespace Composer\Test\Package\Archiver;
|
2012-08-24 08:57:38 +00:00
|
|
|
|
2018-11-12 14:23:32 +00:00
|
|
|
use Composer\Test\TestCase;
|
2012-08-24 08:57:38 +00:00
|
|
|
use Composer\Util\Filesystem;
|
|
|
|
use Composer\Util\ProcessExecutor;
|
2021-03-09 14:49:40 +00:00
|
|
|
use Composer\Package\CompletePackage;
|
2012-08-24 08:57:38 +00:00
|
|
|
|
2016-01-21 12:01:55 +00:00
|
|
|
abstract class ArchiverTest extends TestCase
|
2012-08-24 08:57:38 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Composer\Util\Filesystem
|
|
|
|
*/
|
2012-08-23 19:35:17 +00:00
|
|
|
protected $filesystem;
|
2012-08-24 08:57:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \Composer\Util\ProcessExecutor
|
|
|
|
*/
|
|
|
|
protected $process;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2012-08-23 19:35:17 +00:00
|
|
|
protected $testDir;
|
2012-08-24 08:57:38 +00:00
|
|
|
|
2021-12-08 16:03:05 +00:00
|
|
|
public function setUp(): void
|
2012-08-24 08:57:38 +00:00
|
|
|
{
|
2012-08-23 19:35:17 +00:00
|
|
|
$this->filesystem = new Filesystem();
|
2017-03-08 14:07:29 +00:00
|
|
|
$this->process = new ProcessExecutor();
|
|
|
|
$this->testDir = $this->getUniqueTmpDirectory();
|
2012-08-24 08:57:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-09 16:09:07 +00:00
|
|
|
protected function tearDown(): void
|
2012-08-24 08:57:38 +00:00
|
|
|
{
|
2021-12-09 16:09:07 +00:00
|
|
|
parent::tearDown();
|
2012-08-23 19:35:17 +00:00
|
|
|
$this->filesystem->removeDirectory($this->testDir);
|
2012-08-24 08:57:38 +00:00
|
|
|
}
|
|
|
|
|
2012-10-21 16:23:35 +00:00
|
|
|
/**
|
|
|
|
* Util method to quickly setup a package using the source path built.
|
|
|
|
*
|
2021-03-09 14:49:40 +00:00
|
|
|
* @return CompletePackage
|
2012-10-21 16:23:35 +00:00
|
|
|
*/
|
2022-02-18 10:22:01 +00:00
|
|
|
protected function setupPackage(): CompletePackage
|
2012-08-24 08:57:38 +00:00
|
|
|
{
|
2021-03-09 14:49:40 +00:00
|
|
|
$package = new CompletePackage('archivertest/archivertest', 'master', 'master');
|
2022-02-22 15:47:09 +00:00
|
|
|
$package->setSourceUrl((string) realpath($this->testDir));
|
2012-08-24 08:57:38 +00:00
|
|
|
$package->setSourceReference('master');
|
|
|
|
$package->setSourceType('git');
|
|
|
|
|
2012-08-23 19:35:17 +00:00
|
|
|
return $package;
|
2012-08-24 08:57:38 +00:00
|
|
|
}
|
|
|
|
}
|