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;
|
2012-08-27 08:00:31 +00:00
|
|
|
use Composer\Package\Package;
|
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
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2012-10-21 16:23:35 +00:00
|
|
|
public function tearDown()
|
2012-08-24 08:57:38 +00:00
|
|
|
{
|
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.
|
|
|
|
*
|
|
|
|
* @return \Composer\Package\Package
|
|
|
|
*/
|
2012-08-24 08:57:38 +00:00
|
|
|
protected function setupPackage()
|
|
|
|
{
|
2012-08-27 08:00:31 +00:00
|
|
|
$package = new Package('archivertest/archivertest', 'master', 'master');
|
2012-08-23 19:35:17 +00:00
|
|
|
$package->setSourceUrl(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
|
|
|
}
|
|
|
|
}
|