1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Type annotations

This commit is contained in:
Jordi Boggiano 2021-10-16 10:16:06 +02:00
parent 626370d444
commit c3c6969cf5
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
21 changed files with 166 additions and 35 deletions

View file

@ -20,6 +20,9 @@ use Composer\Package\BasePackage;
class FilterRepositoryTest extends TestCase
{
/**
* @var ArrayRepository
*/
private $arrayRepo;
public function setUp()

View file

@ -19,7 +19,13 @@ use Composer\Util\Filesystem;
class FossilDriverTest extends TestCase
{
/**
* @var string
*/
protected $home;
/**
* @var Config
*/
protected $config;
public function setUp()

View file

@ -24,15 +24,15 @@ use Composer\Util\Http\Response;
*/
class GitBitbucketDriverTest extends TestCase
{
/** @type \Composer\IO\IOInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject */
private $io;
/** @type \Composer\Config */
/** @var Config */
private $config;
/** @type \Composer\Util\HttpDownloader|\PHPUnit_Framework_MockObject_MockObject */
/** @var \Composer\Util\HttpDownloader&\PHPUnit\Framework\MockObject\MockObject */
private $httpDownloader;
/** @type string */
/** @var string */
private $home;
/** @type string */
/** @var string */
private $originUrl = 'bitbucket.org';
protected function setUp()

View file

@ -24,10 +24,25 @@ use Composer\Util\Http\Response;
*/
class GitLabDriverTest extends TestCase
{
/**
* @var string
*/
private $home;
/**
* @var Config
*/
private $config;
/**
* @var \Prophecy\Prophecy\ObjectProphecy
*/
private $io;
/**
* @var \Prophecy\Prophecy\ObjectProphecy
*/
private $process;
/**
* @var \Prophecy\Prophecy\ObjectProphecy
*/
private $httpDownloader;
public function setUp()

View file

@ -19,11 +19,11 @@ use Composer\Config;
class HgDriverTest extends TestCase
{
/** @type \Composer\IO\IOInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject */
private $io;
/** @type Config */
/** @var Config */
private $config;
/** @type string */
/** @var string */
private $home;
public function setUp()

View file

@ -24,13 +24,37 @@ use Composer\Test\Mock\ProcessExecutorMock;
*/
class PerforceDriverTest extends TestCase
{
/**
* @var Config
*/
protected $config;
/**
* @var \Composer\IO\IOInterface&\PHPUnit\Framework\MockObject\MockObject
*/
protected $io;
/**
* @var ProcessExecutorMock
*/
protected $process;
/**
* @var \Composer\Util\HttpDownloader&\PHPUnit\Framework\MockObject\MockObject
*/
protected $httpDownloader;
/**
* @var string
*/
protected $testPath;
/**
* @var PerforceDriver
*/
protected $driver;
/**
* @var array<string, string>
*/
protected $repoConfig;
/**
* @var Perforce&\PHPUnit\Framework\MockObject\MockObject
*/
protected $perforce;
const TEST_URL = 'TEST_PERFORCE_URL';
@ -41,7 +65,11 @@ class PerforceDriverTest extends TestCase
{
$this->testPath = $this->getUniqueTmpDirectory();
$this->config = $this->getTestConfig($this->testPath);
$this->repoConfig = $this->getTestRepoConfig();
$this->repoConfig = array(
'url' => self::TEST_URL,
'depot' => self::TEST_DEPOT,
'branch' => self::TEST_BRANCH,
);
$this->io = $this->getMockIOInterface();
$this->process = new ProcessExecutorMock;
$this->httpDownloader = $this->getMockHttpDownloader();
@ -55,14 +83,6 @@ class PerforceDriverTest extends TestCase
//cleanup directory under test path
$fs = new Filesystem;
$fs->removeDirectory($this->testPath);
$this->driver = null;
$this->perforce = null;
$this->httpDownloader = null;
$this->process = null;
$this->io = null;
$this->repoConfig = null;
$this->config = null;
$this->testPath = null;
}
protected function overrideDriverInternalPerforce(Perforce $perforce)
@ -81,15 +101,6 @@ class PerforceDriverTest extends TestCase
return $config;
}
protected function getTestRepoConfig()
{
return array(
'url' => self::TEST_URL,
'depot' => self::TEST_DEPOT,
'branch' => self::TEST_BRANCH,
);
}
protected function getMockIOInterface()
{
return $this->getMockBuilder('Composer\IO\IOInterface')->getMock();

View file

@ -20,7 +20,13 @@ use Composer\Test\Mock\ProcessExecutorMock;
class SvnDriverTest extends TestCase
{
/**
* @var string
*/
protected $home;
/**
* @var Config
*/
protected $config;
public function setUp()

View file

@ -26,9 +26,18 @@ use Composer\Config;
*/
class VcsRepositoryTest extends TestCase
{
/**
* @var string
*/
private static $composerHome;
/**
* @var string
*/
private static $gitRepo;
private $skipped;
/**
* @var ?string
*/
private $skipped = null;
protected function initialize()
{