mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Merge branch '2.2' into main, update baseline (2085, 104)
This commit is contained in:
commit
615530f0a1
12 changed files with 167 additions and 26 deletions
|
@ -13,6 +13,7 @@
|
|||
namespace Composer\Test\Repository\Vcs;
|
||||
|
||||
use Composer\Repository\Vcs\HgDriver;
|
||||
use Composer\Test\Mock\ProcessExecutorMock;
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Config;
|
||||
|
@ -67,4 +68,49 @@ class HgDriverTest extends TestCase
|
|||
array('https://user@bitbucket.org/user/repo'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetBranchesFilterInvalidBranchNames(): void
|
||||
{
|
||||
$process = $this->getProcessExecutorMock();
|
||||
|
||||
$driver = new HgDriver(array('url' => 'https://example.org/acme.git'), $this->io, $this->config, $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock(), $process);
|
||||
|
||||
$stdout = <<<HG_BRANCHES
|
||||
default 1:dbf6c8acb640
|
||||
--help 1:dbf6c8acb640
|
||||
HG_BRANCHES;
|
||||
|
||||
$stdout1 = <<<HG_BOOKMARKS
|
||||
help 1:dbf6c8acb641
|
||||
--help 1:dbf6c8acb641
|
||||
|
||||
HG_BOOKMARKS;
|
||||
|
||||
$process
|
||||
->expects(array(array(
|
||||
'cmd' => 'hg branches',
|
||||
'stdout' => $stdout,
|
||||
), array(
|
||||
'cmd' => 'hg bookmarks',
|
||||
'stdout' => $stdout1,
|
||||
)));
|
||||
|
||||
$branches = $driver->getBranches();
|
||||
$this->assertSame(array(
|
||||
'help' => 'dbf6c8acb641',
|
||||
'default' => 'dbf6c8acb640',
|
||||
), $branches);
|
||||
}
|
||||
|
||||
public function testFileGetContentInvalidIdentifier(): void
|
||||
{
|
||||
$this->expectException('\RuntimeException');
|
||||
|
||||
$process = $this->getProcessExecutorMock();
|
||||
$driver = new HgDriver(array('url' => 'https://example.org/acme.git'), $this->io, $this->config, $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock(), $process);
|
||||
|
||||
$this->assertNull($driver->getFileContent('file.txt', 'h'));
|
||||
|
||||
$driver->getFileContent('file.txt', '-h');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue