2022-02-23 15:58:18 +00:00
|
|
|
<?php declare(strict_types=1);
|
2016-06-25 01:09:49 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Composer\Test\Repository\Vcs;
|
|
|
|
|
|
|
|
use Composer\Repository\Vcs\FossilDriver;
|
|
|
|
use Composer\Config;
|
2018-11-12 14:23:32 +00:00
|
|
|
use Composer\Test\TestCase;
|
2016-06-25 01:09:49 +00:00
|
|
|
use Composer\Util\Filesystem;
|
|
|
|
|
|
|
|
class FossilDriverTest extends TestCase
|
|
|
|
{
|
2021-10-16 08:16:06 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-06-25 01:09:49 +00:00
|
|
|
protected $home;
|
2021-10-16 08:16:06 +00:00
|
|
|
/**
|
|
|
|
* @var Config
|
|
|
|
*/
|
2016-06-25 01:09:49 +00:00
|
|
|
protected $config;
|
|
|
|
|
2021-12-08 16:03:05 +00:00
|
|
|
public function setUp(): void
|
2016-06-25 01:09:49 +00:00
|
|
|
{
|
2022-05-11 14:05:35 +00:00
|
|
|
$this->home = self::getUniqueTmpDirectory();
|
2016-06-25 01:09:49 +00:00
|
|
|
$this->config = new Config();
|
2022-08-17 12:20:07 +00:00
|
|
|
$this->config->merge([
|
|
|
|
'config' => [
|
2016-06-25 01:09:49 +00:00
|
|
|
'home' => $this->home,
|
2022-08-17 12:20:07 +00:00
|
|
|
],
|
|
|
|
]);
|
2016-06-25 01:09:49 +00:00
|
|
|
}
|
|
|
|
|
2021-12-09 16:09:07 +00:00
|
|
|
protected function tearDown(): void
|
2016-06-25 01:09:49 +00:00
|
|
|
{
|
2021-12-09 16:09:07 +00:00
|
|
|
parent::tearDown();
|
2016-06-25 01:09:49 +00:00
|
|
|
$fs = new Filesystem();
|
|
|
|
$fs->removeDirectory($this->home);
|
|
|
|
}
|
|
|
|
|
2022-02-21 12:42:28 +00:00
|
|
|
public static function supportProvider(): array
|
2016-06-25 01:09:49 +00:00
|
|
|
{
|
2022-08-17 12:20:07 +00:00
|
|
|
return [
|
|
|
|
['http://fossil.kd2.org/kd2fw/', true],
|
|
|
|
['https://chiselapp.com/user/rkeene/repository/flint/index', true],
|
|
|
|
['ssh://fossil.kd2.org/kd2fw.fossil', true],
|
|
|
|
];
|
2016-06-25 01:09:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider supportProvider
|
|
|
|
*/
|
2022-02-22 15:47:09 +00:00
|
|
|
public function testSupport(string $url, bool $assertion): void
|
2016-06-25 01:09:49 +00:00
|
|
|
{
|
|
|
|
$config = new Config();
|
2018-04-12 08:24:56 +00:00
|
|
|
$result = FossilDriver::supports($this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $config, $url);
|
2016-06-25 01:09:49 +00:00
|
|
|
$this->assertEquals($assertion, $result);
|
|
|
|
}
|
|
|
|
}
|