1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 08:32:56 +00:00
composer/tests/Composer/Test/Package/Archiver/ArchiverTest.php
Rob Bast adf3b956d0 try to use unique test directories
any tests that use the filesystem should have their own unique directory, as we run our test suite in parallel and
cleanup of tests (removing directories) should not interfere with currently running tests
2016-01-26 09:41:21 +01:00

63 lines
1.4 KiB
PHP

<?php
/*
* 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.
*/
namespace Composer\Test\Package\Archiver;
use Composer\TestCase;
use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor;
use Composer\Package\Package;
abstract class ArchiverTest extends TestCase
{
/**
* @var \Composer\Util\Filesystem
*/
protected $filesystem;
/**
* @var \Composer\Util\ProcessExecutor
*/
protected $process;
/**
* @var string
*/
protected $testDir;
public function setUp()
{
$this->filesystem = new Filesystem();
$this->process = new ProcessExecutor();
$this->testDir = $this->getUniqueTmpDirectory();
}
public function tearDown()
{
$this->filesystem->removeDirectory($this->testDir);
}
/**
* Util method to quickly setup a package using the source path built.
*
* @return \Composer\Package\Package
*/
protected function setupPackage()
{
$package = new Package('archivertest/archivertest', 'master', 'master');
$package->setSourceUrl(realpath($this->testDir));
$package->setSourceReference('master');
$package->setSourceType('git');
return $package;
}
}