mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add types to Util
tests (#10228)
This commit is contained in:
parent
d51c7685da
commit
2992e8651a
21 changed files with 268 additions and 49 deletions
|
@ -24,8 +24,11 @@ use RecursiveIteratorIterator;
|
|||
*/
|
||||
class GitHubTest extends TestCase
|
||||
{
|
||||
/** @var string */
|
||||
private $password = 'password';
|
||||
/** @var string */
|
||||
private $message = 'mymessage';
|
||||
/** @var string */
|
||||
private $origin = 'github.com';
|
||||
|
||||
public function testUsernamePasswordAuthenticationFlow()
|
||||
|
@ -100,6 +103,9 @@ class GitHubTest extends TestCase
|
|||
$this->assertFalse($github->authorizeOAuthInteractively($this->origin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit\Framework\MockObject\MockObject&\Composer\IO\ConsoleIO
|
||||
*/
|
||||
private function getIOMock()
|
||||
{
|
||||
$io = $this
|
||||
|
@ -111,11 +117,17 @@ class GitHubTest extends TestCase
|
|||
return $io;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit\Framework\MockObject\MockObject&\Composer\Config
|
||||
*/
|
||||
private function getConfigMock()
|
||||
{
|
||||
return $this->getMockBuilder('Composer\Config')->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit\Framework\MockObject\MockObject&\Composer\Util\HttpDownloader
|
||||
*/
|
||||
private function getHttpDownloaderMock()
|
||||
{
|
||||
$httpDownloader = $this
|
||||
|
@ -127,6 +139,9 @@ class GitHubTest extends TestCase
|
|||
return $httpDownloader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit\Framework\MockObject\MockObject&\Composer\Config\JsonConfigSource
|
||||
*/
|
||||
private function getAuthJsonMock()
|
||||
{
|
||||
$authjson = $this
|
||||
|
@ -143,6 +158,9 @@ class GitHubTest extends TestCase
|
|||
return $authjson;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit\Framework\MockObject\MockObject&\Composer\Config\JsonConfigSource
|
||||
*/
|
||||
private function getConfJsonMock()
|
||||
{
|
||||
$confjson = $this
|
||||
|
@ -158,16 +176,4 @@ class GitHubTest extends TestCase
|
|||
|
||||
return $confjson;
|
||||
}
|
||||
|
||||
public static function recursiveFind($array, $needle)
|
||||
{
|
||||
$iterator = new RecursiveArrayIterator($array);
|
||||
$recursive = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
foreach ($recursive as $key => $value) {
|
||||
if ($key === $needle) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue