mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
Merge branch 'master' into 2.0
This commit is contained in:
commit
45ecbae8f5
64 changed files with 377 additions and 612 deletions
|
@ -351,10 +351,10 @@ class AutoloadGeneratorTest extends TestCase
|
|||
file_put_contents($this->workingDir.'/bar.php', '<?php class FilesBar {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'TargetDir');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_target_dir.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_target_dir.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
|
@ -793,10 +793,10 @@ EOF;
|
|||
file_put_contents($this->workingDir.'/root.php', '<?php function testFilesAutoloadGenerationRoot() {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
|
||||
include $this->vendorDir . '/autoload.php';
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGeneration1'));
|
||||
|
@ -861,22 +861,22 @@ EOF;
|
|||
file_put_contents($this->workingDir.'/root.php', '<?php function testFilesAutoloadGenerationRoot() {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions_with_removed_extra.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/include_paths_functions_with_removed_extra.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions_with_removed_extra.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions_with_removed_extra.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileNotExists($this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileNotExists($this->vendorDir.'/composer/include_paths.php');
|
||||
}
|
||||
|
@ -930,9 +930,9 @@ EOF;
|
|||
file_put_contents($this->workingDir . '/root2.php', '<?php function testFilesAutoloadOrderByDependencyRoot() {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php');
|
||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php');
|
||||
|
||||
require $this->vendorDir . '/autoload.php';
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ EOF;
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, "composer", false, '_10');
|
||||
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
$this->assertEquals(
|
||||
array(
|
||||
$this->vendorDir."/a/a/lib",
|
||||
|
@ -1198,8 +1198,8 @@ EOF;
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/a');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
}
|
||||
|
||||
public function testVendorDirExcludedFromWorkingDir()
|
||||
|
@ -1577,12 +1577,12 @@ EOF;
|
|||
{
|
||||
$a = __DIR__.'/Fixtures/autoload_'.$name.'.php';
|
||||
$b = $dir.'/autoload_'.$type.'.php';
|
||||
$this->assertFileEquals($a, $b);
|
||||
$this->assertFileContentEquals($a, $b);
|
||||
}
|
||||
|
||||
public static function assertFileEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
|
||||
public static function assertFileContentEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
|
||||
{
|
||||
return self::assertEquals(
|
||||
self::assertEqualsNormalized(
|
||||
file_get_contents($expected),
|
||||
file_get_contents($actual),
|
||||
$message ?: $expected.' equals '.$actual,
|
||||
|
@ -1593,8 +1593,8 @@ EOF;
|
|||
);
|
||||
}
|
||||
|
||||
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
|
||||
public static function assertEqualsNormalized($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
|
||||
{
|
||||
return parent::assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $actual), $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
|
||||
parent::assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $actual), $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Autoload;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* Tests the Composer\Autoload\ClassLoader class.
|
||||
|
|
|
@ -240,7 +240,7 @@ class ClassMapGeneratorTest extends TestCase
|
|||
$fs->removeDirectory($tempDir);
|
||||
}
|
||||
|
||||
protected function assertEqualsNormalized($expected, $actual, $message = null)
|
||||
protected function assertEqualsNormalized($expected, $actual, $message = '')
|
||||
{
|
||||
foreach ($expected as $ns => $path) {
|
||||
$expected[$ns] = strtr($path, '\\', '/');
|
||||
|
|
|
@ -108,14 +108,8 @@ class CacheTest extends TestCase
|
|||
|
||||
public function testClearCache()
|
||||
{
|
||||
$this->filesystem
|
||||
->method('removeDirectory')
|
||||
->with($this->root.'/')
|
||||
->willReturn(true);
|
||||
|
||||
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
$this->cache = new Cache($io, $this->root, 'a-z0-9.', $this->filesystem);
|
||||
|
||||
$this->assertTrue($this->cache->clear());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,6 +222,7 @@ class ConfigTest extends TestCase
|
|||
|
||||
/**
|
||||
* @dataProvider allowedUrlProvider
|
||||
* @doesNotPerformAssertions
|
||||
*
|
||||
* @param string $url
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Console;
|
||||
|
||||
use Composer\Console\HtmlOutputFormatter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
|
||||
class HtmlOutputFormatterTest extends TestCase
|
||||
|
|
|
@ -18,7 +18,7 @@ use Composer\DependencyResolver\RuleSet;
|
|||
use Composer\DependencyResolver\RuleSetIterator;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\Package\BasePackage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class RuleSetIteratorTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\Test\Downloader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class ArchiveDownloaderTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Downloader;
|
||||
|
||||
use Composer\Downloader\DownloadManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class DownloadManagerTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -224,7 +224,7 @@ class FileDownloaderTest extends TestCase
|
|||
public function testDowngradeShowsAppropriateMessage()
|
||||
{
|
||||
$oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
|
||||
$oldPackage->expects($this->any())
|
||||
$oldPackage->expects($this->once())
|
||||
->method('getFullPrettyVersion')
|
||||
->will($this->returnValue('1.2.0'));
|
||||
$oldPackage->expects($this->once())
|
||||
|
|
|
@ -157,7 +157,7 @@ class FossilDownloaderTest extends TestCase
|
|||
->method('execute')
|
||||
->with($this->equalTo($expectedResetCommand));
|
||||
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
||||
$filesystem->expects($this->any())
|
||||
$filesystem->expects($this->once())
|
||||
->method('removeDirectory')
|
||||
->with($this->equalTo('composerPath'))
|
||||
->will($this->returnValue(true));
|
||||
|
|
|
@ -712,7 +712,7 @@ composer https://github.com/old/url (push)
|
|||
->with($this->equalTo($expectedGitResetCommand))
|
||||
->will($this->returnValue(0));
|
||||
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
||||
$filesystem->expects($this->any())
|
||||
$filesystem->expects($this->once())
|
||||
->method('removeDirectory')
|
||||
->with($this->equalTo('composerPath'))
|
||||
->will($this->returnValue(true));
|
||||
|
|
|
@ -146,7 +146,7 @@ class HgDownloaderTest extends TestCase
|
|||
->method('execute')
|
||||
->with($this->equalTo($expectedResetCommand));
|
||||
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
|
||||
$filesystem->expects($this->any())
|
||||
$filesystem->expects($this->once())
|
||||
->method('removeDirectory')
|
||||
->with($this->equalTo('composerPath'))
|
||||
->will($this->returnValue(true));
|
||||
|
|
|
@ -104,6 +104,9 @@ class PerforceDownloaderTest extends TestCase
|
|||
return $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testInitPerforceInstantiatesANewPerforceObject()
|
||||
{
|
||||
$this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF');
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Installer\NoopInstaller;
|
|||
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||
use Composer\DependencyResolver\Operation\UpdateOperation;
|
||||
use Composer\DependencyResolver\Operation\UninstallOperation;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class InstallationManagerTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Installer;
|
||||
|
||||
use Composer\Installer\InstallerEvent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class InstallerEventTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ class LibraryInstallerTest extends TestCase
|
|||
$this->fs = new Filesystem;
|
||||
|
||||
$this->composer = new Composer();
|
||||
$this->config = new Config();
|
||||
$this->config = new Config(false);
|
||||
$this->composer->setConfig($this->config);
|
||||
|
||||
$this->rootDir = $this->getUniqueTmpDirectory();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Installer;
|
||||
|
||||
use Composer\Installer\MetapackageInstaller;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class MetapackageInstallerTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Installer;
|
||||
|
||||
use Composer\Installer\SuggestedPackagesReporter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass Composer\Installer\SuggestedPackagesReporter
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Json;
|
||||
|
||||
use JsonSchema\Validator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @author Rob Bast <rob.bast@gmail.com>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Json;
|
|||
|
||||
use Seld\JsonLint\ParsingException;
|
||||
use Composer\Json\JsonFile;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class JsonFileTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Json;
|
||||
|
||||
use Composer\Json\JsonFormatter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class JsonFormatterTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Json;
|
||||
|
||||
use Composer\Json\JsonManipulator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class JsonManipulatorTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Json;
|
||||
|
||||
use Composer\Json\JsonValidationException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class JsonValidationExceptionTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Package\Archiver;
|
||||
|
||||
use Composer\Package\Archiver\GitExcludeFilter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class GitExcludeFilterTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Package\Archiver;
|
||||
|
||||
use Composer\Package\Archiver\HgExcludeFilter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class HgExcludeFilterTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
namespace Composer\Test\Package;
|
||||
|
||||
use Composer\Package\BasePackage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class BasePackageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testSetSameRepository()
|
||||
{
|
||||
$package = $this->getMockForAbstractClass('Composer\Package\BasePackage', array('foo'));
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Test\Package\Dumper;
|
|||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Semver\Constraint\Constraint;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class ArrayDumperTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Package\Loader;
|
|||
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class ArrayLoaderTest extends TestCase
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ class ArrayLoaderTest extends TestCase
|
|||
$this->assertEquals('1.2.3.4', $package->getVersion());
|
||||
}
|
||||
|
||||
public function testParseDumpProvider()
|
||||
public function parseDumpProvider()
|
||||
{
|
||||
$validConfig = array(
|
||||
'name' => 'A/B',
|
||||
|
@ -142,7 +142,7 @@ class ArrayLoaderTest extends TestCase
|
|||
* The default parser should default to loading the config as this
|
||||
* allows require-dev libraries to have transport options included.
|
||||
*
|
||||
* @dataProvider testParseDumpProvider
|
||||
* @dataProvider parseDumpProvider
|
||||
*/
|
||||
public function testParseDumpDefaultLoadConfig($config)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ class ArrayLoaderTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testParseDumpProvider
|
||||
* @dataProvider parseDumpProvider
|
||||
*/
|
||||
public function testParseDumpTrueLoadConfig($config)
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ class ArrayLoaderTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testParseDumpProvider
|
||||
* @dataProvider parseDumpProvider
|
||||
*/
|
||||
public function testParseDumpFalseLoadConfig($config)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Package\Loader\RootPackageLoader;
|
|||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use Prophecy\Argument;
|
||||
|
||||
class RootPackageLoaderTest extends TestCase
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Package\Loader;
|
|||
|
||||
use Composer\Package\Loader\ValidatingArrayLoader;
|
||||
use Composer\Package\Loader\InvalidPackageException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class ValidatingArrayLoaderTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Package;
|
|||
|
||||
use Composer\Package\Locker;
|
||||
use Composer\IO\NullIO;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class LockerTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Test\Package\Version;
|
|||
use Composer\Config;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Semver\VersionParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class VersionGuesserTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Package\Version;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class VersionParserTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\Package\Version\VersionSelector;
|
|||
use Composer\Package\Package;
|
||||
use Composer\Package\Link;
|
||||
use Composer\Semver\VersionParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class VersionSelectorTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -105,7 +105,7 @@ class PluginInstallerTest extends TestCase
|
|||
$this->autoloadGenerator = new AutoloadGenerator($dispatcher);
|
||||
|
||||
$this->composer = new Composer();
|
||||
$config = new Config();
|
||||
$config = new Config(false);
|
||||
$this->composer->setConfig($config);
|
||||
$this->composer->setDownloadManager($dm);
|
||||
$this->composer->setRepositoryManager($rm);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Question;
|
||||
|
||||
use Composer\Question\StrictConfirmationQuestion;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
|
|
|
@ -66,8 +66,10 @@ class ChannelReaderTest extends TestCase
|
|||
|
||||
$reader = new \Composer\Repository\Pear\ChannelReader($httpDownloader);
|
||||
|
||||
$reader->read('http://pear.1.0.net/');
|
||||
$reader->read('http://pear.1.1.net/');
|
||||
$pear10 = $reader->read('http://pear.1.0.net/');
|
||||
$this->assertCount(2, $pear10->getPackages());
|
||||
$pear11 = $reader->read('http://pear.1.1.net/');
|
||||
$this->assertCount(3, $pear11->getPackages());
|
||||
}
|
||||
|
||||
public function testShouldCreatePackages()
|
||||
|
|
|
@ -86,7 +86,7 @@ class RepositoryManagerTest extends TestCase
|
|||
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
|
||||
|
||||
$rm->createRepository('composer', array('url' => 'http://example.org'));
|
||||
$rm->createRepository($type, $options);
|
||||
$this->assertInstanceOf('Composer\Repository\RepositoryInterface', $rm->createRepository($type, $options));
|
||||
}
|
||||
|
||||
public function creationCases()
|
||||
|
|
|
@ -105,4 +105,24 @@ abstract class TestCase extends BaseTestCase
|
|||
$this->markTestSkipped($executableName . ' is not found or not executable.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $exception
|
||||
* @param string|null $message
|
||||
* @param int|null $code
|
||||
*/
|
||||
public function setExpectedException($exception, $message = null, $code = null)
|
||||
{
|
||||
if (!class_exists('PHPUnit\Framework\Error\Notice')) {
|
||||
$exception = str_replace('PHPUnit\\Framework\\Error\\', 'PHPUnit_Framework_Error_', $exception);
|
||||
}
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException($exception);
|
||||
if (null !== $message) {
|
||||
$this->expectExceptionMessage($message);
|
||||
}
|
||||
} else {
|
||||
parent::setExpectedException($exception, $message, $code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Util;
|
|||
|
||||
use Composer\Util\Bitbucket;
|
||||
use Composer\Util\Http\Response;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @author Paul Wenke <wenke.paul@gmail.com>
|
||||
|
|
|
@ -20,6 +20,16 @@ use Composer\Test\TestCase;
|
|||
*/
|
||||
class ErrorHandlerTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
ErrorHandler::register();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ErrorHandler handles notices
|
||||
*/
|
||||
|
@ -27,8 +37,6 @@ class ErrorHandlerTest extends TestCase
|
|||
{
|
||||
$this->setExpectedException('\ErrorException', 'Undefined index: baz');
|
||||
|
||||
ErrorHandler::register();
|
||||
|
||||
$array = array('foo' => 'bar');
|
||||
$array['baz'];
|
||||
}
|
||||
|
@ -40,18 +48,15 @@ class ErrorHandlerTest extends TestCase
|
|||
{
|
||||
$this->setExpectedException('\ErrorException', 'array_merge');
|
||||
|
||||
ErrorHandler::register();
|
||||
|
||||
array_merge(array(), 'string');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ErrorHandler handles warnings
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testErrorHandlerRespectsAtOperator()
|
||||
{
|
||||
ErrorHandler::register();
|
||||
|
||||
@trigger_error('test', E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Test\Util;
|
|||
use Composer\Downloader\TransportException;
|
||||
use Composer\Util\GitHub;
|
||||
use Composer\Util\Http\Response;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use RecursiveArrayIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Composer\Test\Util;
|
|||
use Composer\Downloader\TransportException;
|
||||
use Composer\Util\GitLab;
|
||||
use Composer\Util\Http\Response;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @author Jérôme Tamarelle <jerome@tamarelle.net>
|
||||
|
|
|
@ -7,7 +7,7 @@ use Composer\IO\IOInterface;
|
|||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Git;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class GitTest extends TestCase
|
||||
{
|
||||
|
@ -102,6 +102,7 @@ class GitTest extends TestCase
|
|||
$this->mockConfig($protocol);
|
||||
|
||||
$this->process
|
||||
->expects($this->atLeast(2))
|
||||
->method('execute')
|
||||
->willReturnMap(array(
|
||||
array('git command failing', null, null, 1),
|
||||
|
@ -113,11 +114,13 @@ class GitTest extends TestCase
|
|||
->willReturn(false);
|
||||
|
||||
$this->io
|
||||
->expects($this->atLeastOnce())
|
||||
->method('hasAuthentication')
|
||||
->with($this->equalTo('github.com'))
|
||||
->willReturn(true);
|
||||
|
||||
$this->io
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getAuthentication')
|
||||
->with($this->equalTo('github.com'))
|
||||
->willReturn(array('username' => 'token', 'password' => $gitHubToken));
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Composer\Test\Util;
|
|||
|
||||
use Composer\Util\IniHelper;
|
||||
use Composer\XdebugHandler\XdebugHandler;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @author John Stevenson <john-stevenson@blueyonder.co.uk>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\NoProxyPattern;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class NoProxyPatternTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\Perforce;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\Platform;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* PlatformTest
|
||||
|
|
|
@ -110,7 +110,7 @@ class ProcessExecutorTest extends TestCase
|
|||
$output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true);
|
||||
$process = new ProcessExecutor(new ConsoleIO(new ArrayInput(array()), $output, new HelperSet(array())));
|
||||
|
||||
$process->execute('echo \'<error>foo</error>\'');
|
||||
$process->execute('php -r "echo \'<error>foo</error>\'.PHP_EOL;"');
|
||||
$this->assertSame('<error>foo</error>'.PHP_EOL, $output->fetch());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class RemoteFilesystemTest extends TestCase
|
||||
{
|
||||
|
@ -78,6 +78,12 @@ class RemoteFilesystemTest extends TestCase
|
|||
->will($this->returnValue(true))
|
||||
;
|
||||
|
||||
$io
|
||||
->expects($this->once())
|
||||
->method('getAuthentication')
|
||||
->will($this->returnValue(array('username' => null, 'password' => null)))
|
||||
;
|
||||
|
||||
$streamOptions = array('ssl' => array(
|
||||
'allow_self_signed' => true,
|
||||
));
|
||||
|
@ -95,6 +101,12 @@ class RemoteFilesystemTest extends TestCase
|
|||
->will($this->returnValue(true))
|
||||
;
|
||||
|
||||
$io
|
||||
->expects($this->once())
|
||||
->method('getAuthentication')
|
||||
->will($this->returnValue(array('username' => null, 'password' => null)))
|
||||
;
|
||||
|
||||
$streamOptions = array('http' => array(
|
||||
'header' => 'Foo: bar',
|
||||
));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\Silencer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* SilencerTest
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\StreamContextFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class StreamContextFactoryTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\Config;
|
|||
use Composer\IO\NullIO;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\Svn;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class SvnTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\TlsHelper;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class TlsHelperTest extends TestCase
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\Url;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
use Composer\Config;
|
||||
|
||||
class UrlTest extends TestCase
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace Composer\Test\Util;
|
||||
|
||||
use Composer\Util\Zip;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
/**
|
||||
* @author Andreas Schempp <andreas.schempp@terminal42.ch>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue