PHPStan/tests updates (#11996)
* Remove a bunch of inline ignores and migrate all PHPUnit assertions to static calls * Update baseline (1573, 93) * Update commit hashpull/12001/head
parent
dd8af946fd
commit
37d722e73c
|
@ -26,7 +26,7 @@
|
|||
"composer/ca-bundle": "^1.0",
|
||||
"composer/class-map-generator": "^1.0",
|
||||
"composer/metadata-minifier": "^1.0",
|
||||
"composer/semver": "^3.2.5",
|
||||
"composer/semver": "^3.3",
|
||||
"composer/spdx-licenses": "^1.5.7",
|
||||
"composer/xdebug-handler": "^2.0.2 || ^3.0.3",
|
||||
"justinrainbow/json-schema": "^5.2.11",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "213c5ab8912ca04b1f7a77c008875ccc",
|
||||
"content-hash": "9cc98d4fd8dcc30565a6570841b7ec85",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/ca-bundle",
|
||||
|
|
|
@ -4018,11 +4018,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../src/Composer/Util/Http/CurlDownloader.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in &&, int\\<0, 65536\\> given on the right side\\.$#"
|
||||
count: 1
|
||||
path: ../src/Composer/Util/Http/CurlDownloader.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in a negated boolean, string given\\.$#"
|
||||
count: 1
|
||||
|
@ -4758,11 +4753,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../tests/Composer/Test/AllFunctionalTest.php
|
||||
|
||||
-
|
||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\Autoload\\\\AutoloadGeneratorTest\\:\\:assertFileContentEquals\\(\\)\\.$#"
|
||||
count: 28
|
||||
path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Dynamic call to static method Composer\\\\Test\\\\TestCase\\:\\:ensureDirectoryExistsAndClear\\(\\)\\.$#"
|
||||
count: 1
|
||||
|
@ -4941,16 +4931,6 @@ parameters:
|
|||
count: 3
|
||||
path: ../tests/Composer/Test/Installer/BinaryInstallerTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Composer' and Composer\\\\Composer will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Installer/InstallerEventTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\IO…' and Composer\\\\IO\\\\IOInterface will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Installer/InstallerEventTest.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 9
|
||||
|
@ -5021,11 +5001,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../tests/Composer/Test/Json/JsonManipulatorTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$expectedJson of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertJsonStringEqualsJsonString\\(\\) expects string, string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Json/JsonManipulatorTest.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'ask' might not exist on array\\{ask\\: string, reply\\?\\: string\\}\\|array\\{auth\\: array\\{string, string, string\\|null\\}\\}\\|array\\{text\\: string, verbosity\\?\\: 1\\|2\\|4\\|8\\|16\\}\\.$#"
|
||||
count: 2
|
||||
|
@ -5091,11 +5066,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../tests/Composer/Test/Package/Dumper/ArrayDumperTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with true will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
|
||||
count: 1
|
||||
|
@ -5156,11 +5126,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../tests/Composer/Test/Repository/PathRepositoryTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Repository…' and Composer\\\\Repository\\\\RepositoryInterface will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Repository/RepositoryManagerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$objectOrValue of method ReflectionProperty\\:\\:setValue\\(\\) expects object\\|null, object\\|string given\\.$#"
|
||||
count: 1
|
||||
|
@ -5231,31 +5196,16 @@ parameters:
|
|||
count: 2
|
||||
path: ../tests/Composer/Test/Util/PerforceTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$string of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringStartsWith\\(\\) expects string, string\\|false given\\.$#"
|
||||
count: 2
|
||||
path: ../tests/Composer/Test/Util/PerforceTest.php
|
||||
|
||||
-
|
||||
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/PlatformTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with string will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/ProcessExecutorTest.php
|
||||
|
||||
-
|
||||
message: "#^Dynamic call to static method Composer\\\\Util\\\\ProcessExecutor\\:\\:getTimeout\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/ProcessExecutorTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with true and 'callbackGet must…' will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$object of method ReflectionProperty\\:\\:getValue\\(\\) expects object, object\\|string given\\.$#"
|
||||
count: 1
|
||||
|
@ -5271,16 +5221,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, bool\\|string given\\.$#"
|
||||
count: 1
|
||||
path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
|
||||
count: 2
|
||||
path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$certificate does not exist\\.$#"
|
||||
count: 2
|
||||
|
|
|
@ -538,10 +538,7 @@ class Installer
|
|||
return $exitCode;
|
||||
}
|
||||
|
||||
// exists as of composer/semver 3.3.0
|
||||
if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) { // @phpstan-ignore function.alreadyNarrowedType
|
||||
\Composer\Semver\CompilingMatcher::clear();
|
||||
}
|
||||
\Composer\Semver\CompilingMatcher::clear();
|
||||
|
||||
// write lock
|
||||
$platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
|
||||
|
|
|
@ -432,8 +432,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
|
||||
$uniques = [];
|
||||
foreach ($names as $name) {
|
||||
// @phpstan-ignore argument.type
|
||||
$uniques[substr($name, 0, strpos($name, '/'))] = true;
|
||||
$uniques[explode('/', $name, 2)[0]] = true;
|
||||
}
|
||||
|
||||
$vendors = array_keys($uniques);
|
||||
|
|
|
@ -176,12 +176,13 @@ class CurlDownloader
|
|||
}
|
||||
|
||||
$errorMessage = '';
|
||||
// @phpstan-ignore argument.type
|
||||
set_error_handler(static function ($code, $msg) use (&$errorMessage): void {
|
||||
set_error_handler(static function (int $code, string $msg) use (&$errorMessage): bool {
|
||||
if ($errorMessage) {
|
||||
$errorMessage .= "\n";
|
||||
}
|
||||
$errorMessage .= Preg::replace('{^fopen\(.*?\): }', '', $msg);
|
||||
|
||||
return true;
|
||||
});
|
||||
$bodyHandle = fopen($bodyTarget, 'w+b');
|
||||
restore_error_handler();
|
||||
|
|
|
@ -101,8 +101,7 @@ class Response
|
|||
*/
|
||||
public function collect(): void
|
||||
{
|
||||
/** @phpstan-ignore assign.propertyType, assign.propertyType, assign.propertyType */
|
||||
$this->request = $this->code = $this->headers = $this->body = null;
|
||||
unset($this->request, $this->code, $this->headers, $this->body);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -158,8 +158,8 @@ Found 2 abandoned packages:
|
|||
}
|
||||
$auditor = new Auditor();
|
||||
$result = $auditor->audit($io = new BufferIO(), $this->getRepoSet(), $data['packages'], $data['format'] ?? Auditor::FORMAT_PLAIN, $data['warningOnly'], [], $data['abandoned'] ?? Auditor::ABANDONED_IGNORE);
|
||||
$this->assertSame($expected, $result);
|
||||
$this->assertSame($output, trim(str_replace("\r", '', $io->getOutput())));
|
||||
self::assertSame($expected, $result);
|
||||
self::assertSame($output, trim(str_replace("\r", '', $io->getOutput())));
|
||||
}
|
||||
|
||||
public function ignoredIdsProvider(): \Generator {
|
||||
|
@ -311,7 +311,7 @@ Found 2 abandoned packages:
|
|||
$auditor = new Auditor();
|
||||
$result = $auditor->audit($io = $this->getIOMock(), $this->getRepoSet(), $packages, Auditor::FORMAT_PLAIN, false, $ignoredIds);
|
||||
$io->expects($expectedOutput, true);
|
||||
$this->assertSame($exitCode, $result);
|
||||
self::assertSame($exitCode, $result);
|
||||
}
|
||||
|
||||
private function getRepoSet(): RepositorySet
|
||||
|
|
|
@ -93,7 +93,7 @@ class AllFunctionalTest extends TestCase
|
|||
$this->fail($proc->getOutput());
|
||||
}
|
||||
|
||||
$this->assertFileExists(self::$pharPath);
|
||||
self::assertFileExists(self::$pharPath);
|
||||
copy(self::$pharPath, __DIR__.'/../../composer-test.phar');
|
||||
}
|
||||
|
||||
|
@ -164,16 +164,16 @@ class AllFunctionalTest extends TestCase
|
|||
}
|
||||
}
|
||||
if (isset($testData['EXPECT-REGEX'])) {
|
||||
$this->assertMatchesRegularExpression($testData['EXPECT-REGEX'], $this->cleanOutput($output));
|
||||
self::assertMatchesRegularExpression($testData['EXPECT-REGEX'], $this->cleanOutput($output));
|
||||
}
|
||||
if (isset($testData['EXPECT-REGEXES'])) {
|
||||
$cleanOutput = $this->cleanOutput($output);
|
||||
foreach (explode("\n", $testData['EXPECT-REGEXES']) as $regex) {
|
||||
$this->assertMatchesRegularExpression($regex, $cleanOutput, 'Output: '.$output);
|
||||
self::assertMatchesRegularExpression($regex, $cleanOutput, 'Output: '.$output);
|
||||
}
|
||||
}
|
||||
if (isset($testData['EXPECT-EXIT-CODE'])) {
|
||||
$this->assertSame($testData['EXPECT-EXIT-CODE'], $exitCode);
|
||||
self::assertSame($testData['EXPECT-EXIT-CODE'], $exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class ApplicationTest extends TestCase
|
|||
$application->doRun(new ArrayInput(['command' => 'about']), $output);
|
||||
|
||||
$expectedOutput = sprintf('<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']).PHP_EOL;
|
||||
$this->assertStringContainsString($expectedOutput, $output->fetch());
|
||||
self::assertStringContainsString($expectedOutput, $output->fetch());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,6 @@ class ApplicationTest extends TestCase
|
|||
$output = new BufferedOutput();
|
||||
$application->doRun(new ArrayInput(['command' => 'self-update']), $output);
|
||||
|
||||
$this->assertSame('', $output->fetch());
|
||||
self::assertSame('', $output->fetch());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,13 +210,13 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
// Assert that autoload_namespaces.php was correctly generated.
|
||||
$this->assertAutoloadFiles('main', $this->vendorDir.'/composer');
|
||||
self::assertAutoloadFiles('main', $this->vendorDir.'/composer');
|
||||
|
||||
// Assert that autoload_psr4.php was correctly generated.
|
||||
$this->assertAutoloadFiles('psr4', $this->vendorDir.'/composer', 'psr4');
|
||||
self::assertAutoloadFiles('psr4', $this->vendorDir.'/composer', 'psr4');
|
||||
|
||||
// Assert that autoload_classmap.php was correctly generated.
|
||||
$this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testRootPackageDevAutoloading(): void
|
||||
|
@ -250,11 +250,11 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
// check standard autoload
|
||||
$this->assertAutoloadFiles('main5', $this->vendorDir.'/composer');
|
||||
$this->assertAutoloadFiles('classmap7', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('main5', $this->vendorDir.'/composer');
|
||||
self::assertAutoloadFiles('classmap7', $this->vendorDir.'/composer', 'classmap');
|
||||
|
||||
// make sure dev autoload is correctly dumped
|
||||
$this->assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files');
|
||||
self::assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files');
|
||||
}
|
||||
|
||||
public function testRootPackageDevAutoloadingDisabledByDefault(): void
|
||||
|
@ -283,11 +283,11 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
// check standard autoload
|
||||
$this->assertAutoloadFiles('main4', $this->vendorDir.'/composer');
|
||||
$this->assertAutoloadFiles('classmap7', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('main4', $this->vendorDir.'/composer');
|
||||
self::assertAutoloadFiles('classmap7', $this->vendorDir.'/composer', 'classmap');
|
||||
|
||||
// make sure dev autoload is disabled when dev mode is set to false
|
||||
$this->assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php'));
|
||||
self::assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php'));
|
||||
}
|
||||
|
||||
public function testVendorDirSameAsWorkingDir(): void
|
||||
|
@ -316,9 +316,9 @@ class AutoloadGeneratorTest extends TestCase
|
|||
file_put_contents($this->vendorDir.'/composersrc/foo.php', '<?php class ClassMapFoo {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_2');
|
||||
$this->assertAutoloadFiles('main3', $this->vendorDir.'/composer');
|
||||
$this->assertAutoloadFiles('psr4_3', $this->vendorDir.'/composer', 'psr4');
|
||||
$this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('main3', $this->vendorDir.'/composer');
|
||||
self::assertAutoloadFiles('psr4_3', $this->vendorDir.'/composer', 'psr4');
|
||||
self::assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testRootPackageAutoloadingAlternativeVendorDir(): void
|
||||
|
@ -345,9 +345,9 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->fs->ensureDirectoryExists($this->workingDir.'/composersrc');
|
||||
file_put_contents($this->workingDir.'/composersrc/foo.php', '<?php class ClassMapFoo {}');
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_3');
|
||||
$this->assertAutoloadFiles('main2', $this->vendorDir.'/composer');
|
||||
$this->assertAutoloadFiles('psr4_2', $this->vendorDir.'/composer', 'psr4');
|
||||
$this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('main2', $this->vendorDir.'/composer');
|
||||
self::assertAutoloadFiles('psr4_2', $this->vendorDir.'/composer', 'psr4');
|
||||
self::assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testRootPackageAutoloadingWithTargetDir(): void
|
||||
|
@ -374,11 +374,11 @@ 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->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');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_target_dir.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
self::assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testDuplicateFilesWarning(): void
|
||||
|
@ -431,8 +431,8 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5');
|
||||
$this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
self::assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
}
|
||||
|
||||
public function testVendorsAutoloadingWithMetapackages(): void
|
||||
|
@ -465,8 +465,8 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5');
|
||||
$this->assertAutoloadFiles('vendors_meta', $this->vendorDir.'/composer');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
self::assertAutoloadFiles('vendors_meta', $this->vendorDir.'/composer');
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
}
|
||||
|
||||
public function testNonDevAutoloadExclusionWithRecursion(): void
|
||||
|
@ -498,8 +498,8 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5');
|
||||
$this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
self::assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
}
|
||||
|
||||
public function testNonDevAutoloadShouldIncludeReplacedPackages(): void
|
||||
|
@ -527,7 +527,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_5');
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
[
|
||||
'B\\C\\C' => $this->vendorDir.'/b/b/src/C/C.php',
|
||||
'Composer\\InstalledVersions' => $this->vendorDir . '/composer/InstalledVersions.php',
|
||||
|
@ -565,8 +565,8 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5');
|
||||
$this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
self::assertAutoloadFiles('vendors', $this->vendorDir.'/composer');
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty.");
|
||||
}
|
||||
|
||||
public function testNonDevAutoloadReplacesNestedRequirements(): void
|
||||
|
@ -618,7 +618,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5');
|
||||
|
||||
$this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testPharAutoload(): void
|
||||
|
@ -657,9 +657,9 @@ class AutoloadGeneratorTest extends TestCase
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, 'Phar');
|
||||
|
||||
$this->assertAutoloadFiles('phar', $this->vendorDir . '/composer');
|
||||
$this->assertAutoloadFiles('phar_psr4', $this->vendorDir . '/composer', 'psr4');
|
||||
$this->assertAutoloadFiles('phar_static', $this->vendorDir . '/composer', 'static');
|
||||
self::assertAutoloadFiles('phar', $this->vendorDir . '/composer');
|
||||
self::assertAutoloadFiles('phar_psr4', $this->vendorDir . '/composer', 'psr4');
|
||||
self::assertAutoloadFiles('phar_static', $this->vendorDir . '/composer', 'static');
|
||||
}
|
||||
|
||||
public function testPSRToClassMapIgnoresNonExistingDir(): void
|
||||
|
@ -676,8 +676,8 @@ class AutoloadGeneratorTest extends TestCase
|
|||
->will($this->returnValue([]));
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'Composer\\InstalledVersions' => $this->vendorDir.'/composer/InstalledVersions.php',
|
||||
],
|
||||
|
@ -706,7 +706,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
file_put_contents($this->workingDir.'/psr4/badfile.php', '<?php namespace psr4; class badclass {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
|
||||
$expectedClassmap = <<<EOF
|
||||
<?php
|
||||
|
@ -723,7 +723,7 @@ return array(
|
|||
);
|
||||
|
||||
EOF;
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
}
|
||||
|
||||
public function testVendorsClassMapAutoloading(): void
|
||||
|
@ -753,8 +753,8 @@ EOF;
|
|||
file_put_contents($this->vendorDir.'/b/b/lib/c.php', '<?php class ClassMapBaz {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'ClassMapBar' => $this->vendorDir.'/b/b/src/b.php',
|
||||
'ClassMapBaz' => $this->vendorDir.'/b/b/lib/c.php',
|
||||
|
@ -763,7 +763,7 @@ EOF;
|
|||
],
|
||||
include $this->vendorDir.'/composer/autoload_classmap.php'
|
||||
);
|
||||
$this->assertAutoloadFiles('classmap4', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap4', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
public function testVendorsClassMapAutoloadingWithTargetDir(): void
|
||||
|
@ -794,8 +794,8 @@ EOF;
|
|||
file_put_contents($this->vendorDir.'/b/b/src/c.php', '<?php class ClassMapBaz {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'ClassMapBar' => $this->vendorDir.'/a/a/target/lib/b.php',
|
||||
'ClassMapBaz' => $this->vendorDir.'/b/b/src/c.php',
|
||||
|
@ -836,8 +836,8 @@ EOF;
|
|||
file_put_contents($this->vendorDir.'/c/c/foo/test.php', '<?php class ClassMapBaz {}');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7');
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'ClassMapBar' => $this->vendorDir.'/b/b/test.php',
|
||||
'ClassMapBaz' => $this->vendorDir.'/c/c/foo/test.php',
|
||||
|
@ -846,9 +846,9 @@ EOF;
|
|||
],
|
||||
include $this->vendorDir.'/composer/autoload_classmap.php'
|
||||
);
|
||||
$this->assertAutoloadFiles('classmap5', $this->vendorDir.'/composer', 'classmap');
|
||||
$this->assertStringNotContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
$this->assertStringNotContainsString('$loader->setApcuPrefix(', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertAutoloadFiles('classmap5', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertStringNotContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertStringNotContainsString('$loader->setApcuPrefix(', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
}
|
||||
|
||||
public function testClassMapAutoloadingAuthoritativeAndApcu(): void
|
||||
|
@ -884,8 +884,8 @@ EOF;
|
|||
$this->generator->setApcu(true);
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7');
|
||||
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'ClassMapBar' => $this->vendorDir.'/b/b/ClassMapBar.php',
|
||||
'ClassMapBaz' => $this->vendorDir.'/c/c/foo/ClassMapBaz.php',
|
||||
|
@ -894,10 +894,10 @@ EOF;
|
|||
],
|
||||
include $this->vendorDir.'/composer/autoload_classmap.php'
|
||||
);
|
||||
$this->assertAutoloadFiles('classmap8', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap8', $this->vendorDir.'/composer', 'classmap');
|
||||
|
||||
$this->assertStringContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
$this->assertStringContainsString('$loader->setApcuPrefix(', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertStringContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertStringContainsString('$loader->setApcuPrefix(', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
}
|
||||
|
||||
public function testClassMapAutoloadingAuthoritativeAndApcuPrefix(): void
|
||||
|
@ -933,8 +933,8 @@ EOF;
|
|||
$this->generator->setApcu(true, 'custom\'Prefix');
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7');
|
||||
|
||||
$this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
$this->assertEquals(
|
||||
self::assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated.");
|
||||
self::assertEquals(
|
||||
[
|
||||
'ClassMapBar' => $this->vendorDir.'/b/b/ClassMapBar.php',
|
||||
'ClassMapBaz' => $this->vendorDir.'/c/c/foo/ClassMapBaz.php',
|
||||
|
@ -943,10 +943,10 @@ EOF;
|
|||
],
|
||||
include $this->vendorDir.'/composer/autoload_classmap.php'
|
||||
);
|
||||
$this->assertAutoloadFiles('classmap8', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap8', $this->vendorDir.'/composer', 'classmap');
|
||||
|
||||
$this->assertStringContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
$this->assertStringContainsString('$loader->setApcuPrefix(\'custom\\\'Prefix\');', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertStringContainsString('$loader->setClassMapAuthoritative(true);', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertStringContainsString('$loader->setApcuPrefix(\'custom\\\'Prefix\');', (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
}
|
||||
|
||||
public function testFilesAutoloadGeneration(): void
|
||||
|
@ -982,18 +982,18 @@ 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->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');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
|
||||
$loader = require $this->vendorDir . '/autoload.php';
|
||||
$loader->unregister();
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGeneration1'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGeneration2'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGeneration3'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGeneration4'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadGenerationRoot'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadGeneration1'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadGeneration2'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadGeneration3'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadGeneration4'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadGenerationRoot'));
|
||||
}
|
||||
|
||||
public function testFilesAutoloadGenerationRemoveExtraEntitiesFromAutoloadFiles(): void
|
||||
|
@ -1047,24 +1047,24 @@ 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->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');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
self::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->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');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions_with_removed_extra.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
self::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->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->assertFileDoesNotExist($this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileDoesNotExist($this->vendorDir.'/composer/include_paths.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
self::assertFileDoesNotExist($this->vendorDir.'/composer/autoload_files.php');
|
||||
self::assertFileDoesNotExist($this->vendorDir.'/composer/include_paths.php');
|
||||
}
|
||||
|
||||
public function testFilesAutoloadOrderByDependencies(): void
|
||||
|
@ -1124,19 +1124,19 @@ 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->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');
|
||||
self::assertFileContentEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php');
|
||||
self::assertFileContentEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php');
|
||||
|
||||
$loader = require $this->vendorDir . '/autoload.php';
|
||||
$loader->unregister();
|
||||
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependency1'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependency2'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependency3'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependency4'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependency5'));
|
||||
$this->assertTrue(function_exists('testFilesAutoloadOrderByDependencyRoot'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependency1'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependency2'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependency3'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependency4'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependency5'));
|
||||
self::assertTrue(function_exists('testFilesAutoloadOrderByDependencyRoot'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1235,9 +1235,9 @@ return array(
|
|||
EOF;
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $rootPackage, $this->im, 'composer', true, '_9');
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
}
|
||||
|
||||
public function testIncludePathFileGeneration(): void
|
||||
|
@ -1266,8 +1266,8 @@ EOF;
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_10');
|
||||
|
||||
$this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
$this->assertEquals(
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
self::assertEquals(
|
||||
[
|
||||
$this->vendorDir."/a/a/lib",
|
||||
$this->vendorDir."/b/b/library",
|
||||
|
@ -1300,7 +1300,7 @@ EOF;
|
|||
$loader = require $this->vendorDir."/autoload.php";
|
||||
$loader->unregister();
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
$this->vendorDir."/a/a/lib".PATH_SEPARATOR.$oldIncludePath,
|
||||
get_include_path()
|
||||
);
|
||||
|
@ -1329,7 +1329,7 @@ EOF;
|
|||
$loader = require $this->vendorDir."/autoload.php";
|
||||
$loader->unregister();
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
$this->workingDir."/lib".PATH_SEPARATOR.$this->workingDir."/src".PATH_SEPARATOR.$this->vendorDir."/a/a/lib".PATH_SEPARATOR.$oldIncludePath,
|
||||
get_include_path()
|
||||
);
|
||||
|
@ -1353,7 +1353,7 @@ EOF;
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_12');
|
||||
|
||||
$this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php");
|
||||
self::assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php");
|
||||
}
|
||||
|
||||
public function testPreAndPostEventsAreDispatchedDuringAutoloadDump(): void
|
||||
|
@ -1367,7 +1367,7 @@ EOF;
|
|||
[ScriptEvents::POST_AUTOLOAD_DUMP, false]
|
||||
];
|
||||
|
||||
$this->assertSame(array_shift($series), [$type, $dev]);
|
||||
self::assertSame(array_shift($series), [$type, $dev]);
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
@ -1400,8 +1400,8 @@ EOF;
|
|||
$this->fs->ensureDirectoryExists($this->vendorDir.'/a');
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath');
|
||||
$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');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
}
|
||||
|
||||
public function testVendorDirExcludedFromWorkingDir(): void
|
||||
|
@ -1511,11 +1511,11 @@ return array(
|
|||
|
||||
EOF;
|
||||
|
||||
$this->assertStringEqualsFile($vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
$this->assertStringEqualsFile($vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
$this->assertStringEqualsFile($vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
$this->assertStringContainsString("\$vendorDir . '/b/b/bootstrap.php',\n", (string) file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
$this->assertStringContainsString("\$baseDir . '/test.php',\n", (string) file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
self::assertStringEqualsFile($vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
self::assertStringContainsString("\$vendorDir . '/b/b/bootstrap.php',\n", (string) file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
self::assertStringContainsString("\$baseDir . '/test.php',\n", (string) file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
}
|
||||
|
||||
public function testUpLevelRelativePaths(): void
|
||||
|
@ -1596,10 +1596,10 @@ return array(
|
|||
|
||||
EOF;
|
||||
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
$this->assertStringContainsString("\$baseDir . '/../test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
self::assertStringContainsString("\$baseDir . '/../test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
}
|
||||
|
||||
public function testAutoloadRulesInPackageThatDoesNotExistOnDisk(): void
|
||||
|
@ -1632,7 +1632,7 @@ return array(
|
|||
);
|
||||
|
||||
EOF;
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
|
||||
$dep->setAutoload([
|
||||
'psr-4' => ['Acme\Foo\\' => './src-psr4'],
|
||||
|
@ -1652,7 +1652,7 @@ return array(
|
|||
);
|
||||
|
||||
EOF;
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
|
||||
$dep->setAutoload([
|
||||
'classmap' => ['classmap'],
|
||||
|
@ -1660,14 +1660,14 @@ EOF;
|
|||
try {
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19');
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertSame('Could not scan for classes inside "'.$this->vendorDir.'/dep/a/classmap" which does not appear to be a file nor a folder', $e->getMessage());
|
||||
self::assertSame('Could not scan for classes inside "'.$this->vendorDir.'/dep/a/classmap" which does not appear to be a file nor a folder', $e->getMessage());
|
||||
}
|
||||
|
||||
$dep->setAutoload([
|
||||
'files' => ['./test.php'],
|
||||
]);
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19');
|
||||
$this->assertStringContainsString("\$vendorDir . '/dep/a/test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
self::assertStringContainsString("\$vendorDir . '/dep/a/test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
|
||||
$package->setAutoload([
|
||||
'exclude-from-classmap' => ['../excludedroot', 'root/excl'],
|
||||
|
@ -1677,7 +1677,7 @@ EOF;
|
|||
]);
|
||||
$map = $this->generator->buildPackageMap($this->im, $package, [$dep]);
|
||||
$parsed = $this->generator->parseAutoloads($map, $package);
|
||||
$this->assertSame([
|
||||
self::assertSame([
|
||||
preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/excludedroot($|/)',
|
||||
preg_quote(strtr((string) realpath($this->workingDir), '\\', '/')).'/root/excl($|/)',
|
||||
], $parsed['exclude-from-classmap']);
|
||||
|
@ -1746,9 +1746,9 @@ return array(
|
|||
|
||||
EOF;
|
||||
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap);
|
||||
}
|
||||
|
||||
public function testVendorSubstringPath(): void
|
||||
|
@ -1794,8 +1794,8 @@ return array(
|
|||
EOF;
|
||||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'VendorSubstring');
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace);
|
||||
self::assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4);
|
||||
}
|
||||
|
||||
public function testExcludeFromClassmap(): void
|
||||
|
@ -1864,7 +1864,7 @@ EOF;
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
// Assert that autoload_classmap.php was correctly generated.
|
||||
$this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap');
|
||||
self::assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1896,11 +1896,11 @@ EOF;
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
if (null === $expectedFixture) {
|
||||
$this->assertFileDoesNotExist($this->vendorDir . '/composer/platform_check.php');
|
||||
$this->assertStringNotContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertFileDoesNotExist($this->vendorDir . '/composer/platform_check.php');
|
||||
self::assertStringNotContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
} else {
|
||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
||||
$this->assertStringContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
self::assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
||||
self::assertStringContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2025,7 @@ EOF;
|
|||
{
|
||||
$a = __DIR__.'/Fixtures/autoload_'.$name.'.php';
|
||||
$b = $dir.'/autoload_'.$type.'.php';
|
||||
$this->assertFileContentEquals($a, $b);
|
||||
self::assertFileContentEquals($a, $b);
|
||||
}
|
||||
|
||||
public static function assertFileContentEquals(string $expected, string $actual, ?string $message = null): void
|
||||
|
|
|
@ -34,7 +34,7 @@ class ClassLoaderTest extends TestCase
|
|||
$loader->add('Pearlike_', __DIR__ . '/Fixtures');
|
||||
$loader->addPsr4('ShinyVendor\\ShinyPackage\\', __DIR__ . '/Fixtures');
|
||||
$loader->loadClass($class);
|
||||
$this->assertTrue(class_exists($class, false), "->loadClass() loads '$class'");
|
||||
self::assertTrue(class_exists($class, false), "->loadClass() loads '$class'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ class ClassLoaderTest extends TestCase
|
|||
public function testGetPrefixesWithNoPSR0Configuration(): void
|
||||
{
|
||||
$loader = new ClassLoader();
|
||||
$this->assertEmpty($loader->getPrefixes());
|
||||
self::assertEmpty($loader->getPrefixes());
|
||||
}
|
||||
|
||||
public function testSerializability(): void
|
||||
|
|
|
@ -77,9 +77,9 @@ class CacheTest extends TestCase
|
|||
$this->cache->gc(600, 1024 * 1024 * 1024);
|
||||
|
||||
for ($i = 1; $i < 4; $i++) {
|
||||
$this->assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
|
||||
self::assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
|
||||
}
|
||||
$this->assertFileExists("{$this->root}/cached.file0.zip");
|
||||
self::assertFileExists("{$this->root}/cached.file0.zip");
|
||||
}
|
||||
|
||||
public function testRemoveFilesWhenCacheIsTooLarge(): void
|
||||
|
@ -106,15 +106,15 @@ class CacheTest extends TestCase
|
|||
$this->cache->gc(600, 1500);
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$this->assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
|
||||
self::assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
|
||||
}
|
||||
$this->assertFileExists("{$this->root}/cached.file3.zip");
|
||||
self::assertFileExists("{$this->root}/cached.file3.zip");
|
||||
}
|
||||
|
||||
public function testClearCache(): void
|
||||
{
|
||||
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
$cache = new Cache($io, $this->root, 'a-z0-9.', $this->filesystem);
|
||||
$this->assertTrue($cache->clear());
|
||||
self::assertTrue($cache->clear());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ class AboutCommandTest extends TestCase
|
|||
{
|
||||
$composerVersion = Composer::getVersion();
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'about']));
|
||||
$this->assertStringContainsString("Composer - Dependency Manager for PHP - version $composerVersion", $appTester->getDisplay());
|
||||
self::assertSame(0, $appTester->run(['command' => 'about']));
|
||||
self::assertStringContainsString("Composer - Dependency Manager for PHP - version $composerVersion", $appTester->getDisplay());
|
||||
|
||||
$this->assertStringContainsString("Composer is a dependency manager tracking local dependencies of your projects and libraries.", $appTester->getDisplay());
|
||||
$this->assertStringContainsString("See https://getcomposer.org/ for more information.", $appTester->getDisplay());
|
||||
self::assertStringContainsString("Composer is a dependency manager tracking local dependencies of your projects and libraries.", $appTester->getDisplay());
|
||||
self::assertStringContainsString("See https://getcomposer.org/ for more information.", $appTester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class ArchiveCommandTest extends TestCase
|
|||
null
|
||||
)->willReturn(0);
|
||||
|
||||
$this->assertEquals(0, $command->run($input, $output));
|
||||
self::assertEquals(0, $command->run($input, $output));
|
||||
}
|
||||
|
||||
public function testUsesConfigFromComposerObjectWithPackageName(): void
|
||||
|
|
|
@ -45,7 +45,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
$this->expectExceptionMessage($expectedExceptionMessage);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => $command] + $parameters));
|
||||
self::assertEquals(Command::FAILURE, $appTester->run(['command' => $command] + $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,7 +97,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
$this->expectExceptionMessage('A valid composer.lock file is required to run this command with --locked');
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
Command::FAILURE,
|
||||
$appTester->run(['command' => $command] + $parameters + ['--locked' => true]
|
||||
)
|
||||
|
@ -125,7 +125,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
$this->expectExceptionMessage(sprintf('Could not find package "%s" in your project', $packageToBeInspected));
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
Command::FAILURE,
|
||||
$appTester->run(['command' => $command] + $parameters)
|
||||
);
|
||||
|
@ -164,7 +164,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
|
||||
$appTester = $this->getApplicationTester();
|
||||
|
||||
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => $command] + $parameters));
|
||||
self::assertEquals(Command::FAILURE, $appTester->run(['command' => $command] + $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,7 +199,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => $command] + $parameters);
|
||||
|
||||
$this->assertSame($expectedWarningMessage, trim($appTester->getDisplay(true)));
|
||||
self::assertSame($expectedWarningMessage, trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,7 +296,7 @@ class BaseDependencyCommandTest extends TestCase
|
|||
|
||||
self::assertSame($expectedStatusCode, $appTester->getStatusCode());
|
||||
|
||||
$this->assertEquals(trim($expectedOutput), $this->trimLines($appTester->getDisplay(true)));
|
||||
self::assertEquals(trim($expectedOutput), $this->trimLines($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,7 +420,7 @@ OUTPUT
|
|||
]);
|
||||
|
||||
self::assertSame($expectedStatusCode, $appTester->getStatusCode());
|
||||
$this->assertSame(trim($expectedOutput), $this->trimLines($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expectedOutput), $this->trimLines($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,10 +41,10 @@ class BumpCommandTest extends TestCase
|
|||
}
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame($exitCode, $appTester->run(array_merge(['command' => 'bump'], $command)));
|
||||
self::assertSame($exitCode, $appTester->run(array_merge(['command' => 'bump'], $command)));
|
||||
|
||||
$json = new JsonFile('./composer.json');
|
||||
$this->assertSame($expected, $json->read());
|
||||
self::assertSame($expected, $json->read());
|
||||
}
|
||||
|
||||
public function testBumpFailsOnNonExistingComposerFile(): void
|
||||
|
@ -54,9 +54,9 @@ class BumpCommandTest extends TestCase
|
|||
unlink($composerJsonPath);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(1, $appTester->run(['command' => 'bump'], ['capture_stderr_separately' => true]));
|
||||
self::assertSame(1, $appTester->run(['command' => 'bump'], ['capture_stderr_separately' => true]));
|
||||
|
||||
$this->assertStringContainsString("./composer.json is not readable.", $appTester->getErrorOutput());
|
||||
self::assertStringContainsString("./composer.json is not readable.", $appTester->getErrorOutput());
|
||||
}
|
||||
|
||||
public function testBumpFailsOnWriteErrorToComposerFile(): void
|
||||
|
@ -66,9 +66,9 @@ class BumpCommandTest extends TestCase
|
|||
chmod($composerJsonPath, 0444);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(1, $appTester->run(['command' => 'bump'], ['capture_stderr_separately' => true]));
|
||||
self::assertSame(1, $appTester->run(['command' => 'bump'], ['capture_stderr_separately' => true]));
|
||||
|
||||
$this->assertStringContainsString("./composer.json is not writable.", $appTester->getErrorOutput());
|
||||
self::assertStringContainsString("./composer.json is not writable.", $appTester->getErrorOutput());
|
||||
}
|
||||
|
||||
public static function provideTests(): \Generator
|
||||
|
|
|
@ -47,7 +47,7 @@ class CheckPlatformReqsCommandTest extends TestCase
|
|||
$appTester->run(array_merge(['command' => 'check-platform-reqs'], $command));
|
||||
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testExceptionThrownIfNoLockfileFound(): void
|
||||
|
@ -89,7 +89,7 @@ ext-foobar 2.3.4 success'
|
|||
];
|
||||
}
|
||||
|
||||
public function testFailedPlatformRequirement(): void
|
||||
public function testFailedPlatformRequirement(): void
|
||||
{
|
||||
$this->initTempComposer([
|
||||
'require' => [
|
||||
|
@ -137,6 +137,6 @@ ext-foobar 2.3.4 success'
|
|||
}
|
||||
]';
|
||||
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ClearCacheCommandTest extends TestCase
|
|||
|
||||
$output = $appTester->getDisplay(true);
|
||||
|
||||
$this->assertStringContainsString('All caches cleared.', $output);
|
||||
self::assertStringContainsString('All caches cleared.', $output);
|
||||
}
|
||||
|
||||
public function testClearCacheCommandWithOptionGarbageCollection(): void
|
||||
|
@ -44,7 +44,7 @@ class ClearCacheCommandTest extends TestCase
|
|||
|
||||
$output = $appTester->getDisplay(true);
|
||||
|
||||
$this->assertStringContainsString('All caches garbage-collected.', $output);
|
||||
self::assertStringContainsString('All caches garbage-collected.', $output);
|
||||
}
|
||||
|
||||
public function testClearCacheCommandWithOptionNoCache(): void
|
||||
|
@ -56,6 +56,6 @@ class ClearCacheCommandTest extends TestCase
|
|||
|
||||
$output = $appTester->getDisplay(true);
|
||||
|
||||
$this->assertStringContainsString('Cache is not enabled', $output);
|
||||
self::assertStringContainsString('Cache is not enabled', $output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ConfigCommandTest extends TestCase
|
|||
|
||||
$appTester->assertCommandIsSuccessful($appTester->getDisplay());
|
||||
|
||||
$this->assertSame($expected, json_decode((string) file_get_contents('composer.json'), true));
|
||||
self::assertSame($expected, json_decode((string) file_get_contents('composer.json'), true));
|
||||
}
|
||||
|
||||
public static function provideConfigUpdates(): \Generator
|
||||
|
@ -133,8 +133,8 @@ class ConfigCommandTest extends TestCase
|
|||
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
|
||||
$this->assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
$this->assertSame($composerJson, json_decode((string) file_get_contents('composer.json'), true), 'The composer.json should not be modified by config reads');
|
||||
self::assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
self::assertSame($composerJson, json_decode((string) file_get_contents('composer.json'), true), 'The composer.json should not be modified by config reads');
|
||||
}
|
||||
|
||||
public static function provideConfigReads(): \Generator
|
||||
|
|
|
@ -23,13 +23,13 @@ class DiagnoseCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'diagnose']);
|
||||
|
||||
$this->assertSame(1, $appTester->getStatusCode());
|
||||
self::assertSame(1, $appTester->getStatusCode());
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Checking composer.json: <warning>WARNING</warning>
|
||||
self::assertStringContainsString('Checking composer.json: <warning>WARNING</warning>
|
||||
<warning>No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.</warning>', $output);
|
||||
|
||||
$this->assertStringContainsString('Checking http connectivity to packagist: OK
|
||||
self::assertStringContainsString('Checking http connectivity to packagist: OK
|
||||
Checking https connectivity to packagist: OK
|
||||
Checking github.com rate limit: ', $output);
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ Checking github.com rate limit: ', $output);
|
|||
$appTester->assertCommandIsSuccessful();
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Checking composer.json: OK', $output);
|
||||
self::assertStringContainsString('Checking composer.json: OK', $output);
|
||||
|
||||
$this->assertStringContainsString('Checking http connectivity to packagist: OK
|
||||
self::assertStringContainsString('Checking http connectivity to packagist: OK
|
||||
Checking https connectivity to packagist: OK
|
||||
Checking github.com rate limit: ', $output);
|
||||
}
|
||||
|
|
|
@ -10,41 +10,41 @@ class DumpAutoloadCommandTest extends TestCase
|
|||
public function testDumpAutoload(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating autoload files', $output);
|
||||
$this->assertStringContainsString('Generated autoload files', $output);
|
||||
self::assertStringContainsString('Generating autoload files', $output);
|
||||
self::assertStringContainsString('Generated autoload files', $output);
|
||||
}
|
||||
|
||||
public function testDumpDevAutoload(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--dev' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload', '--dev' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating autoload files', $output);
|
||||
$this->assertStringContainsString('Generated autoload files', $output);
|
||||
self::assertStringContainsString('Generating autoload files', $output);
|
||||
self::assertStringContainsString('Generated autoload files', $output);
|
||||
}
|
||||
|
||||
public function testDumpNoDevAutoload(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--dev' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload', '--dev' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating autoload files', $output);
|
||||
$this->assertStringContainsString('Generated autoload files', $output);
|
||||
self::assertStringContainsString('Generating autoload files', $output);
|
||||
self::assertStringContainsString('Generated autoload files', $output);
|
||||
}
|
||||
|
||||
public function testUsingOptimizeAndStrictPsr(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--optimize' => true, '--strict-psr' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload', '--optimize' => true, '--strict-psr' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating optimized autoload files', $output);
|
||||
$this->assertMatchesRegularExpression('/Generated optimized autoload files containing \d+ classes/', $output);
|
||||
self::assertStringContainsString('Generating optimized autoload files', $output);
|
||||
self::assertMatchesRegularExpression('/Generated optimized autoload files containing \d+ classes/', $output);
|
||||
}
|
||||
|
||||
public function testFailsUsingStrictPsrIfClassMapViolationsAreFound(): void
|
||||
|
@ -59,30 +59,30 @@ class DumpAutoloadCommandTest extends TestCase
|
|||
mkdir($dir . '/src/');
|
||||
file_put_contents($dir . '/src/Foo.php', '<?php namespace Application\Src; class Foo {}');
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(1, $appTester->run(['command' => 'dump-autoload', '--optimize' => true, '--strict-psr' => true]));
|
||||
self::assertSame(1, $appTester->run(['command' => 'dump-autoload', '--optimize' => true, '--strict-psr' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertMatchesRegularExpression('/Class Application\\\Src\\\Foo located in .*? does not comply with psr-4 autoloading standard. Skipping./', $output);
|
||||
self::assertMatchesRegularExpression('/Class Application\\\Src\\\Foo located in .*? does not comply with psr-4 autoloading standard. Skipping./', $output);
|
||||
}
|
||||
|
||||
public function testUsingClassmapAuthoritative(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--classmap-authoritative' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload', '--classmap-authoritative' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating optimized autoload files (authoritative)', $output);
|
||||
$this->assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
|
||||
self::assertStringContainsString('Generating optimized autoload files (authoritative)', $output);
|
||||
self::assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
|
||||
}
|
||||
|
||||
public function testUsingClassmapAuthoritativeAndStrictPsr(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--classmap-authoritative' => true, '--strict-psr' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload', '--classmap-authoritative' => true, '--strict-psr' => true]));
|
||||
|
||||
$output = $appTester->getDisplay(true);
|
||||
$this->assertStringContainsString('Generating optimized autoload files', $output);
|
||||
$this->assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
|
||||
self::assertStringContainsString('Generating optimized autoload files', $output);
|
||||
self::assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
|
||||
}
|
||||
|
||||
public function testStrictPsrDoesNotWorkWithoutOptimizedAutoloader(): void
|
||||
|
@ -112,7 +112,7 @@ class DumpAutoloadCommandTest extends TestCase
|
|||
]);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
|
||||
self::assertStringContainsString('ComposerAutoloaderInitFoobar', (string) file_get_contents($dir . '/vendor/autoload.php'));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class DumpAutoloadCommandTest extends TestCase
|
|||
);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
|
||||
self::assertStringContainsString('ComposerAutoloaderInitFoobar', (string) file_get_contents($dir . '/vendor/autoload.php'));
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class DumpAutoloadCommandTest extends TestCase
|
|||
);
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'dump-autoload']));
|
||||
|
||||
self::assertStringContainsString('ComposerAutoloaderInit2d4a6be9a93712c5d6a119b26734a047', (string) file_get_contents($dir . '/vendor/autoload.php'));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class ExecCommandTest extends TestCase
|
|||
|
||||
$output = $appTester->getDisplay(true);
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
'Available binaries:
|
||||
- b
|
||||
- c
|
||||
|
|
|
@ -56,7 +56,7 @@ class FundCommandTest extends TestCase
|
|||
$appTester->run(array_merge(['command' => 'fund'], $command));
|
||||
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public static function useCaseProvider(): Generator
|
||||
|
|
|
@ -54,7 +54,7 @@ class HomeCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(array_merge(['command' => 'home', '--show' => true], $command));
|
||||
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public static function useCaseProvider(): Generator
|
||||
|
|
|
@ -23,24 +23,24 @@ class InitCommandTest extends TestCase
|
|||
{
|
||||
$command = new InitCommand;
|
||||
$author = $this->callParseAuthorString($command, 'John Smith <john@example.com>');
|
||||
$this->assertEquals('John Smith', $author['name']);
|
||||
$this->assertEquals('john@example.com', $author['email']);
|
||||
self::assertEquals('John Smith', $author['name']);
|
||||
self::assertEquals('john@example.com', $author['email']);
|
||||
}
|
||||
|
||||
public function testParseValidAuthorStringWithoutEmail(): void
|
||||
{
|
||||
$command = new InitCommand;
|
||||
$author = $this->callParseAuthorString($command, 'John Smith');
|
||||
$this->assertEquals('John Smith', $author['name']);
|
||||
$this->assertNull($author['email']);
|
||||
self::assertEquals('John Smith', $author['name']);
|
||||
self::assertNull($author['email']);
|
||||
}
|
||||
|
||||
public function testParseValidUtf8AuthorString(): void
|
||||
{
|
||||
$command = new InitCommand;
|
||||
$author = $this->callParseAuthorString($command, 'Matti Meikäläinen <matti@example.com>');
|
||||
$this->assertEquals('Matti Meikäläinen', $author['name']);
|
||||
$this->assertEquals('matti@example.com', $author['email']);
|
||||
self::assertEquals('Matti Meikäläinen', $author['name']);
|
||||
self::assertEquals('matti@example.com', $author['email']);
|
||||
}
|
||||
|
||||
public function testParseValidUtf8AuthorStringWithNonSpacingMarks(): void
|
||||
|
@ -49,16 +49,16 @@ class InitCommandTest extends TestCase
|
|||
$utf8_expected = "Matti Meika\xCC\x88la\xCC\x88inen";
|
||||
$command = new InitCommand;
|
||||
$author = $this->callParseAuthorString($command, $utf8_expected." <matti@example.com>");
|
||||
$this->assertEquals($utf8_expected, $author['name']);
|
||||
$this->assertEquals('matti@example.com', $author['email']);
|
||||
self::assertEquals($utf8_expected, $author['name']);
|
||||
self::assertEquals('matti@example.com', $author['email']);
|
||||
}
|
||||
|
||||
public function testParseNumericAuthorString(): void
|
||||
{
|
||||
$command = new InitCommand;
|
||||
$author = $this->callParseAuthorString($command, 'h4x0r <h4x@example.com>');
|
||||
$this->assertEquals('h4x0r', $author['name']);
|
||||
$this->assertEquals('h4x@example.com', $author['email']);
|
||||
self::assertEquals('h4x0r', $author['name']);
|
||||
self::assertEquals('h4x@example.com', $author['email']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,8 +72,8 @@ class InitCommandTest extends TestCase
|
|||
$command,
|
||||
'Johnathon "Johnny" Smith <john@example.com>'
|
||||
);
|
||||
$this->assertEquals('Johnathon "Johnny" Smith', $author['name']);
|
||||
$this->assertEquals('john@example.com', $author['email']);
|
||||
self::assertEquals('Johnathon "Johnny" Smith', $author['name']);
|
||||
self::assertEquals('john@example.com', $author['email']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,8 @@ class InitCommandTest extends TestCase
|
|||
$command,
|
||||
'Johnathon (Johnny) Smith <john@example.com>'
|
||||
);
|
||||
$this->assertEquals('Johnathon (Johnny) Smith', $author['name']);
|
||||
$this->assertEquals('john@example.com', $author['email']);
|
||||
self::assertEquals('Johnathon (Johnny) Smith', $author['name']);
|
||||
self::assertEquals('john@example.com', $author['email']);
|
||||
}
|
||||
|
||||
public function testParseEmptyAuthorString(): void
|
||||
|
@ -109,21 +109,21 @@ class InitCommandTest extends TestCase
|
|||
{
|
||||
$command = new InitCommand;
|
||||
$namespace = $command->namespaceFromPackageName('new_projects.acme-extra/package-name');
|
||||
$this->assertEquals('NewProjectsAcmeExtra\PackageName', $namespace);
|
||||
self::assertEquals('NewProjectsAcmeExtra\PackageName', $namespace);
|
||||
}
|
||||
|
||||
public function testNamespaceFromInvalidPackageName(): void
|
||||
{
|
||||
$command = new InitCommand;
|
||||
$namespace = $command->namespaceFromPackageName('invalid-package-name');
|
||||
$this->assertNull($namespace);
|
||||
self::assertNull($namespace);
|
||||
}
|
||||
|
||||
public function testNamespaceFromMissingPackageName(): void
|
||||
{
|
||||
$command = new InitCommand;
|
||||
$namespace = $command->namespaceFromPackageName('');
|
||||
$this->assertNull($namespace);
|
||||
self::assertNull($namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,7 +168,7 @@ class InitCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'init', '--no-interaction' => true, '--name' => 'test/pkg']);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -176,7 +176,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunInvalidAuthorArgumentInvalidEmail(): void
|
||||
|
@ -210,7 +210,7 @@ class InitCommandTest extends TestCase
|
|||
'--author' => 'Mr. Test <test@example.org>',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -224,7 +224,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunAuthorArgumentMissingEmail(): void
|
||||
|
@ -241,7 +241,7 @@ class InitCommandTest extends TestCase
|
|||
'--author' => 'Mr. Test',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -254,7 +254,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunSingleRepositoryArgument(): void
|
||||
|
@ -273,7 +273,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -287,7 +287,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunMultipleRepositoryArguments(): void
|
||||
|
@ -308,7 +308,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -335,7 +335,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunStability(): void
|
||||
|
@ -352,7 +352,7 @@ class InitCommandTest extends TestCase
|
|||
'--stability' => 'dev',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -361,7 +361,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunInvalidStability(): void
|
||||
|
@ -378,9 +378,9 @@ class InitCommandTest extends TestCase
|
|||
'--stability' => 'bogus',
|
||||
], ['capture_stderr_separately' => true]);
|
||||
|
||||
$this->assertSame(1, $appTester->getStatusCode());
|
||||
self::assertSame(1, $appTester->getStatusCode());
|
||||
|
||||
$this->assertMatchesRegularExpression("/minimum-stability\s+:\s+Does not have a value in the enumeration/", $appTester->getErrorOutput());
|
||||
self::assertMatchesRegularExpression("/minimum-stability\s+:\s+Does not have a value in the enumeration/", $appTester->getErrorOutput());
|
||||
}
|
||||
|
||||
public function testRunRequireOne(): void
|
||||
|
@ -399,7 +399,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -409,7 +409,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunRequireMultiple(): void
|
||||
|
@ -429,7 +429,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -440,7 +440,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunInvalidRequire(): void
|
||||
|
@ -479,7 +479,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -490,7 +490,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunRequireDevMultiple(): void
|
||||
|
@ -510,7 +510,7 @@ class InitCommandTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -522,7 +522,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunInvalidRequireDev(): void
|
||||
|
@ -559,7 +559,7 @@ class InitCommandTest extends TestCase
|
|||
'--autoload' => 'testMapping/'
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -572,7 +572,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunHomepage(): void
|
||||
|
@ -589,7 +589,7 @@ class InitCommandTest extends TestCase
|
|||
'--homepage' => 'https://example.org/'
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -598,7 +598,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunInvalidHomepage(): void
|
||||
|
@ -615,8 +615,8 @@ class InitCommandTest extends TestCase
|
|||
'--homepage' => 'not-a-url',
|
||||
], ['capture_stderr_separately' => true]);
|
||||
|
||||
$this->assertSame(1, $appTester->getStatusCode());
|
||||
$this->assertMatchesRegularExpression("/homepage\s*:\s*Invalid URL format/", $appTester->getErrorOutput());
|
||||
self::assertSame(1, $appTester->getStatusCode());
|
||||
self::assertMatchesRegularExpression("/homepage\s*:\s*Invalid URL format/", $appTester->getErrorOutput());
|
||||
}
|
||||
|
||||
public function testRunDescription(): void
|
||||
|
@ -633,7 +633,7 @@ class InitCommandTest extends TestCase
|
|||
'--description' => 'My first example package'
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -642,7 +642,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunType(): void
|
||||
|
@ -659,7 +659,7 @@ class InitCommandTest extends TestCase
|
|||
'--type' => 'library'
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -668,7 +668,7 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
|
||||
public function testRunLicense(): void
|
||||
|
@ -685,7 +685,7 @@ class InitCommandTest extends TestCase
|
|||
'--license' => 'MIT'
|
||||
]);
|
||||
|
||||
$this->assertSame(0, $appTester->getStatusCode());
|
||||
self::assertSame(0, $appTester->getStatusCode());
|
||||
|
||||
$expected = [
|
||||
'name' => 'test/pkg',
|
||||
|
@ -694,6 +694,6 @@ class InitCommandTest extends TestCase
|
|||
];
|
||||
|
||||
$file = new JsonFile($dir . '/composer.json');
|
||||
$this->assertEquals($expected, $file->read());
|
||||
self::assertEquals($expected, $file->read());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class InstallCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(array_merge(['command' => 'install'], $command));
|
||||
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function errorCaseProvider(): Generator
|
||||
|
@ -118,7 +118,7 @@ OUTPUT
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'install', '--no-progress' => true]);
|
||||
|
||||
$this->assertSame('Installing dependencies from lock file (including require-dev)
|
||||
self::assertSame('Installing dependencies from lock file (including require-dev)
|
||||
Verifying lock file contents can be installed on current platform.
|
||||
Package operations: 2 installs, 0 updates, 0 removals
|
||||
- Installing root/another (1.0.0)
|
||||
|
@ -148,7 +148,7 @@ Generating autoload files', trim($appTester->getDisplay(true)));
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'install', '--no-progress' => true, '--no-dev' => true]);
|
||||
|
||||
$this->assertSame('Installing dependencies from lock file
|
||||
self::assertSame('Installing dependencies from lock file
|
||||
Verifying lock file contents can be installed on current platform.
|
||||
Package operations: 1 install, 0 updates, 0 removals
|
||||
- Installing root/req (1.0.0)
|
||||
|
@ -175,7 +175,7 @@ Generating autoload files', trim($appTester->getDisplay(true)));
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'install', '--no-progress' => true]);
|
||||
|
||||
$this->assertSame('Installing dependencies from lock file (including require-dev)
|
||||
self::assertSame('Installing dependencies from lock file (including require-dev)
|
||||
Verifying lock file contents can be installed on current platform.
|
||||
Package operations: 1 install, 0 updates, 0 removals
|
||||
- Installing root/another (1.0.0)
|
||||
|
|
|
@ -54,7 +54,7 @@ class LicensesCommandTest extends TestCase
|
|||
public function testBasicRun(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'license']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'license']));
|
||||
|
||||
$expected = [
|
||||
["Name:", "test/pkg"],
|
||||
|
@ -81,14 +81,14 @@ class LicensesCommandTest extends TestCase
|
|||
if (!isset($expected[$i])) {
|
||||
$this->fail('Got more output lines than expected');
|
||||
}
|
||||
$this->assertMatchesRegularExpression("/" . implode("\s+", $expected[$i]) . "/", $line);
|
||||
self::assertMatchesRegularExpression("/" . implode("\s+", $expected[$i]) . "/", $line);
|
||||
}
|
||||
}
|
||||
|
||||
public function testNoDev(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'license', '--no-dev' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'license', '--no-dev' => true]));
|
||||
|
||||
$expected = [
|
||||
["Name:", "test/pkg"],
|
||||
|
@ -114,14 +114,14 @@ class LicensesCommandTest extends TestCase
|
|||
if (!isset($expected[$i])) {
|
||||
$this->fail('Got more output lines than expected');
|
||||
}
|
||||
$this->assertMatchesRegularExpression("/" . implode("\s+", $expected[$i]) . "/", $line);
|
||||
self::assertMatchesRegularExpression("/" . implode("\s+", $expected[$i]) . "/", $line);
|
||||
}
|
||||
}
|
||||
|
||||
public function testFormatJson(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'license', '--format' => 'json'], ['capture_stderr_separately' => true]));
|
||||
self::assertSame(0, $appTester->run(['command' => 'license', '--format' => 'json'], ['capture_stderr_separately' => true]));
|
||||
|
||||
$expected = [
|
||||
"name" => "test/pkg",
|
||||
|
@ -153,13 +153,13 @@ class LicensesCommandTest extends TestCase
|
|||
]
|
||||
];
|
||||
|
||||
$this->assertSame($expected, json_decode($appTester->getDisplay(), true));
|
||||
self::assertSame($expected, json_decode($appTester->getDisplay(), true));
|
||||
}
|
||||
|
||||
public function testFormatSummary(): void
|
||||
{
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertSame(0, $appTester->run(['command' => 'license', '--format' => 'summary']));
|
||||
self::assertSame(0, $appTester->run(['command' => 'license', '--format' => 'summary']));
|
||||
|
||||
$expected = [
|
||||
['-', '-'],
|
||||
|
@ -176,7 +176,7 @@ class LicensesCommandTest extends TestCase
|
|||
foreach ($expected as $i => $expect) {
|
||||
[$key, $value] = $expect;
|
||||
|
||||
$this->assertMatchesRegularExpression("/$key\s+$value/", $lines[$i]);
|
||||
self::assertMatchesRegularExpression("/$key\s+$value/", $lines[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@ class ReinstallCommandTest extends TestCase
|
|||
'packages' => $packages
|
||||
]);
|
||||
|
||||
$this->assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
self::assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function caseProvider(): Generator
|
||||
public function caseProvider(): Generator
|
||||
{
|
||||
yield 'reinstall a package' => [
|
||||
['root/req', 'root/anotherreq'],
|
||||
|
|
|
@ -28,7 +28,7 @@ class RemoveCommandTest extends TestCase
|
|||
$this->expectExceptionMessage('Not enough arguments (missing: "packages").');
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => 'remove']));
|
||||
self::assertEquals(Command::FAILURE, $appTester->run(['command' => 'remove']));
|
||||
}
|
||||
|
||||
public function testExceptionWhenRunningUnusedWithoutLockFile(): void
|
||||
|
@ -39,7 +39,7 @@ class RemoveCommandTest extends TestCase
|
|||
$this->expectExceptionMessage('A valid composer.lock file is required to run this command with --unused');
|
||||
|
||||
$appTester = $this->getApplicationTester();
|
||||
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => 'remove', '--unused' => true]));
|
||||
self::assertEquals(Command::FAILURE, $appTester->run(['command' => 'remove', '--unused' => true]));
|
||||
}
|
||||
|
||||
public function testWarningWhenRemovingNonExistentPackage(): void
|
||||
|
@ -64,7 +64,7 @@ class RemoveCommandTest extends TestCase
|
|||
self::assertEquals(Command::SUCCESS, $appTester->run(['command' => 'remove', 'packages' => ['root/req'], '--dev' => true, '--no-update' => true, '--no-interaction' => true]));
|
||||
self::assertSame('<warning>root/req could not be found in require-dev but it is present in require</warning>
|
||||
./composer.json has been updated', trim($appTester->getDisplay(true)));
|
||||
$this->assertEquals(['require' => ['root/req' => '1.*']], (new JsonFile('./composer.json'))->read());
|
||||
self::assertEquals(['require' => ['root/req' => '1.*']], (new JsonFile('./composer.json'))->read());
|
||||
}
|
||||
|
||||
public function testWarningWhenRemovingPackageWithDeprecatedDependenciesFlag(): void
|
||||
|
@ -79,7 +79,7 @@ class RemoveCommandTest extends TestCase
|
|||
self::assertEquals(Command::SUCCESS, $appTester->run(['command' => 'remove', 'packages' => ['root/req'], '--update-with-dependencies' => true, '--no-update' => true, '--no-interaction' => true]));
|
||||
self::assertSame('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>
|
||||
./composer.json has been updated', trim($appTester->getDisplay(true)));
|
||||
$this->assertEmpty((new JsonFile('./composer.json'))->read());
|
||||
self::assertEmpty((new JsonFile('./composer.json'))->read());
|
||||
}
|
||||
|
||||
public function testMessageOutputWhenNoUnusedPackagesToRemove(): void
|
||||
|
|
|
@ -96,9 +96,9 @@ Installation failed, reverting ./composer.json to its original content.
|
|||
|
||||
if (str_contains($expected, '%d')) {
|
||||
$pattern = '{^'.str_replace('%d', '[0-9.]+', preg_quote(trim($expected))).'$}';
|
||||
$this->assertMatchesRegularExpression($pattern, trim($appTester->getDisplay(true)));
|
||||
self::assertMatchesRegularExpression($pattern, trim($appTester->getDisplay(true)));
|
||||
} else {
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ class RunScriptCommandTest extends TestCase
|
|||
|
||||
$output = $appTester->getDisplay();
|
||||
|
||||
$this->assertStringContainsString('Runs the test script as defined in composer.json', $output, 'The default description for the test script should be printed');
|
||||
$this->assertStringContainsString('Run the codestyle fixer', $output, 'The custom description for the fix-cs script should be printed');
|
||||
self::assertStringContainsString('Runs the test script as defined in composer.json', $output, 'The default description for the test script should be printed');
|
||||
self::assertStringContainsString('Run the codestyle fixer', $output, 'The custom description for the fix-cs script should be printed');
|
||||
}
|
||||
|
||||
public function testCanDefineAliases(): void
|
||||
|
@ -132,7 +132,7 @@ class RunScriptCommandTest extends TestCase
|
|||
$actualAliases = $array['usage'];
|
||||
array_shift($actualAliases);
|
||||
|
||||
$this->assertSame($expectedAliases, $actualAliases, 'The custom aliases for the test command should be printed');
|
||||
self::assertSame($expectedAliases, $actualAliases, 'The custom aliases for the test command should be printed');
|
||||
}
|
||||
|
||||
public function testExecutionOfCustomSymfonyCommand(): void
|
||||
|
|
|
@ -53,7 +53,7 @@ class SelfUpdateCommandTest extends TestCase
|
|||
$appTester->run(['command' => 'self-update']);
|
||||
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
$this->assertStringContainsString('Upgrading to version', $appTester->getDisplay());
|
||||
self::assertStringContainsString('Upgrading to version', $appTester->getDisplay());
|
||||
}
|
||||
|
||||
public function testUpdateToSpecificVersion(): void
|
||||
|
@ -62,7 +62,7 @@ class SelfUpdateCommandTest extends TestCase
|
|||
$appTester->run(['command' => 'self-update', 'version' => '2.4.0']);
|
||||
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
$this->assertStringContainsString('Upgrading to version 2.4.0', $appTester->getDisplay());
|
||||
self::assertStringContainsString('Upgrading to version 2.4.0', $appTester->getDisplay());
|
||||
}
|
||||
|
||||
public function testUpdateWithInvalidOptionThrowsException(): void
|
||||
|
@ -87,8 +87,8 @@ class SelfUpdateCommandTest extends TestCase
|
|||
$appTester->run(['command' => 'self-update', $option => true]);
|
||||
$appTester->assertCommandIsSuccessful();
|
||||
|
||||
$this->assertStringContainsString('Upgrading to version', $appTester->getDisplay());
|
||||
$this->assertStringContainsString($expectedOutput, $appTester->getDisplay());
|
||||
self::assertStringContainsString('Upgrading to version', $appTester->getDisplay());
|
||||
self::assertStringContainsString($expectedOutput, $appTester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class StatusCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(['command' => 'status']);
|
||||
|
||||
$this->assertSame('No local changes', trim($appTester->getDisplay(true)));
|
||||
self::assertSame('No local changes', trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,8 +73,8 @@ class StatusCommandTest extends TestCase
|
|||
$expected = 'You have changes in the following dependencies:';
|
||||
$actual = trim($appTester->getDisplay(true));
|
||||
|
||||
$this->assertStringContainsString($expected, $actual);
|
||||
$this->assertStringContainsString($packageData['name'], $actual);
|
||||
self::assertStringContainsString($expected, $actual);
|
||||
self::assertStringContainsString($packageData['name'], $actual);
|
||||
}
|
||||
|
||||
public static function locallyModifiedPackagesUseCaseProvider(): Generator
|
||||
|
|
|
@ -29,7 +29,7 @@ class UpdateCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(array_merge(['command' => 'update', '--dry-run' => true, '--no-audit' => true], $command));
|
||||
|
||||
$this->assertStringMatchesFormat(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertStringMatchesFormat(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public static function provideUpdates(): \Generator
|
||||
|
|
|
@ -30,7 +30,7 @@ class ValidateCommandTest extends TestCase
|
|||
$appTester = $this->getApplicationTester();
|
||||
$appTester->run(array_merge(['command' => 'validate'], $command));
|
||||
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testValidateOnFileIssues(): void
|
||||
|
@ -42,7 +42,7 @@ class ValidateCommandTest extends TestCase
|
|||
$appTester->run(['command' => 'validate']);
|
||||
$expected = './composer.json not found.';
|
||||
|
||||
$this->assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
self::assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testWithComposerLock(): void
|
||||
|
@ -63,7 +63,7 @@ Read more about correctly resolving merge conflicts https://getcomposer.org/doc/
|
|||
and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r
|
||||
OUTPUT;
|
||||
|
||||
$this->assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
self::assertSame(trim($expected), trim($appTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testUnaccessibleFile(): void
|
||||
|
@ -79,8 +79,8 @@ OUTPUT;
|
|||
$appTester->run(['command' => 'validate']);
|
||||
$expected = './composer.json is not readable.';
|
||||
|
||||
$this->assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
$this->assertSame(3, $appTester->getStatusCode());
|
||||
self::assertSame($expected, trim($appTester->getDisplay(true)));
|
||||
self::assertSame(3, $appTester->getStatusCode());
|
||||
chmod($directory.'/composer.json', 0700);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,13 +136,13 @@ class CompletionFunctionalTest extends TestCase
|
|||
$suggestions = $tester->complete($input);
|
||||
|
||||
if (null === $expectedSuggestions) {
|
||||
$this->assertEmpty($suggestions);
|
||||
self::assertEmpty($suggestions);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$diff = array_diff($expectedSuggestions, $suggestions);
|
||||
$this->assertEmpty($diff, sprintf('Suggestions must contain "%s". Got "%s".', implode('", "', $diff), implode('", "', $suggestions)));
|
||||
self::assertEmpty($diff, sprintf('Suggestions must contain "%s". Got "%s".', implode('", "', $diff), implode('", "', $suggestions)));
|
||||
}
|
||||
|
||||
private function getApplication(): Application
|
||||
|
|
|
@ -22,7 +22,7 @@ class ComposerTest extends TestCase
|
|||
$package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
|
||||
$composer->setPackage($package);
|
||||
|
||||
$this->assertSame($package, $composer->getPackage());
|
||||
self::assertSame($package, $composer->getPackage());
|
||||
}
|
||||
|
||||
public function testSetGetLocker(): void
|
||||
|
@ -31,7 +31,7 @@ class ComposerTest extends TestCase
|
|||
$locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock();
|
||||
$composer->setLocker($locker);
|
||||
|
||||
$this->assertSame($locker, $composer->getLocker());
|
||||
self::assertSame($locker, $composer->getLocker());
|
||||
}
|
||||
|
||||
public function testSetGetRepositoryManager(): void
|
||||
|
@ -40,7 +40,7 @@ class ComposerTest extends TestCase
|
|||
$manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock();
|
||||
$composer->setRepositoryManager($manager);
|
||||
|
||||
$this->assertSame($manager, $composer->getRepositoryManager());
|
||||
self::assertSame($manager, $composer->getRepositoryManager());
|
||||
}
|
||||
|
||||
public function testSetGetDownloadManager(): void
|
||||
|
@ -50,7 +50,7 @@ class ComposerTest extends TestCase
|
|||
$manager = $this->getMockBuilder('Composer\Downloader\DownloadManager')->setConstructorArgs([$io])->getMock();
|
||||
$composer->setDownloadManager($manager);
|
||||
|
||||
$this->assertSame($manager, $composer->getDownloadManager());
|
||||
self::assertSame($manager, $composer->getDownloadManager());
|
||||
}
|
||||
|
||||
public function testSetGetInstallationManager(): void
|
||||
|
@ -59,6 +59,6 @@ class ComposerTest extends TestCase
|
|||
$manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
|
||||
$composer->setInstallationManager($manager);
|
||||
|
||||
$this->assertSame($manager, $composer->getInstallationManager());
|
||||
self::assertSame($manager, $composer->getInstallationManager());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
|
||||
$jsonConfigSource->addRepository('example_tld', ['type' => 'git', 'url' => 'example.tld']);
|
||||
|
||||
$this->assertFileEquals(self::fixturePath('config/config-with-exampletld-repository.json'), $config);
|
||||
self::assertFileEquals(self::fixturePath('config/config-with-exampletld-repository.json'), $config);
|
||||
}
|
||||
|
||||
public function testAddRepositoryWithOptions(): void
|
||||
|
@ -68,7 +68,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
],
|
||||
]);
|
||||
|
||||
$this->assertFileEquals(self::fixturePath('config/config-with-exampletld-repository-and-options.json'), $config);
|
||||
self::assertFileEquals(self::fixturePath('config/config-with-exampletld-repository-and-options.json'), $config);
|
||||
}
|
||||
|
||||
public function testRemoveRepository(): void
|
||||
|
@ -78,7 +78,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
|
||||
$jsonConfigSource->removeRepository('example_tld');
|
||||
|
||||
$this->assertFileEquals(self::fixturePath('composer-repositories.json'), $config);
|
||||
self::assertFileEquals(self::fixturePath('composer-repositories.json'), $config);
|
||||
}
|
||||
|
||||
public function testAddPackagistRepositoryWithFalseValue(): void
|
||||
|
@ -88,7 +88,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
|
||||
$jsonConfigSource->addRepository('packagist', false);
|
||||
|
||||
$this->assertFileEquals(self::fixturePath('config/config-with-packagist-false.json'), $config);
|
||||
self::assertFileEquals(self::fixturePath('config/config-with-packagist-false.json'), $config);
|
||||
}
|
||||
|
||||
public function testRemovePackagist(): void
|
||||
|
@ -98,7 +98,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
$jsonConfigSource = new JsonConfigSource(new JsonFile($config));
|
||||
$jsonConfigSource->removeRepository('packagist');
|
||||
|
||||
$this->assertFileEquals(self::fixturePath('composer-repositories.json'), $config);
|
||||
self::assertFileEquals(self::fixturePath('composer-repositories.json'), $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,7 +120,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
|
||||
$jsonConfigSource->addLink($type, $name, $value);
|
||||
|
||||
$this->assertFileEquals($compareAgainst, $composerJson);
|
||||
self::assertFileEquals($compareAgainst, $composerJson);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ class JsonConfigSourceTest extends TestCase
|
|||
|
||||
$jsonConfigSource->removeLink($type, $name);
|
||||
|
||||
$this->assertFileEquals($compareAgainst, $composerJson);
|
||||
self::assertFileEquals($compareAgainst, $composerJson);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@ class ConfigTest extends TestCase
|
|||
}
|
||||
$config->merge(['repositories' => $localConfig]);
|
||||
|
||||
$this->assertEquals($expected, $config->getRepositories());
|
||||
self::assertEquals($expected, $config->getRepositories());
|
||||
}
|
||||
|
||||
public static function dataAddPackagistRepository(): array
|
||||
|
@ -149,7 +149,7 @@ class ConfigTest extends TestCase
|
|||
$config->merge(['config' => ['preferred-install' => 'source']]);
|
||||
$config->merge(['config' => ['preferred-install' => 'dist']]);
|
||||
|
||||
$this->assertEquals('dist', $config->get('preferred-install'));
|
||||
self::assertEquals('dist', $config->get('preferred-install'));
|
||||
}
|
||||
|
||||
public function testMergePreferredInstall(): void
|
||||
|
@ -161,7 +161,7 @@ class ConfigTest extends TestCase
|
|||
// This assertion needs to make sure full wildcard preferences are placed last
|
||||
// Handled by composer because we convert string preferences for BC, all other
|
||||
// care for ordering and collision prevention is up to the user
|
||||
$this->assertEquals(['foo/*' => 'source', '*' => 'dist'], $config->get('preferred-install'));
|
||||
self::assertEquals(['foo/*' => 'source', '*' => 'dist'], $config->get('preferred-install'));
|
||||
}
|
||||
|
||||
public function testMergeGithubOauth(): void
|
||||
|
@ -170,7 +170,7 @@ class ConfigTest extends TestCase
|
|||
$config->merge(['config' => ['github-oauth' => ['foo' => 'bar']]]);
|
||||
$config->merge(['config' => ['github-oauth' => ['bar' => 'baz']]]);
|
||||
|
||||
$this->assertEquals(['foo' => 'bar', 'bar' => 'baz'], $config->get('github-oauth'));
|
||||
self::assertEquals(['foo' => 'bar', 'bar' => 'baz'], $config->get('github-oauth'));
|
||||
}
|
||||
|
||||
public function testVarReplacement(): void
|
||||
|
@ -180,9 +180,9 @@ class ConfigTest extends TestCase
|
|||
$config->merge(['config' => ['bin-dir' => '$HOME', 'cache-dir' => '~/foo/']]);
|
||||
|
||||
$home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '\\/');
|
||||
$this->assertEquals('b', $config->get('c'));
|
||||
$this->assertEquals($home, $config->get('bin-dir'));
|
||||
$this->assertEquals($home.'/foo', $config->get('cache-dir'));
|
||||
self::assertEquals('b', $config->get('c'));
|
||||
self::assertEquals($home, $config->get('bin-dir'));
|
||||
self::assertEquals($home.'/foo', $config->get('cache-dir'));
|
||||
}
|
||||
|
||||
public function testRealpathReplacement(): void
|
||||
|
@ -195,9 +195,9 @@ class ConfigTest extends TestCase
|
|||
]]);
|
||||
|
||||
$home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '\\/');
|
||||
$this->assertEquals('/foo/bar/vendor', $config->get('vendor-dir'));
|
||||
$this->assertEquals($home.'/foo', $config->get('bin-dir'));
|
||||
$this->assertEquals('/baz', $config->get('cache-dir'));
|
||||
self::assertEquals('/foo/bar/vendor', $config->get('vendor-dir'));
|
||||
self::assertEquals($home.'/foo', $config->get('bin-dir'));
|
||||
self::assertEquals('/baz', $config->get('cache-dir'));
|
||||
}
|
||||
|
||||
public function testStreamWrapperDirs(): void
|
||||
|
@ -207,7 +207,7 @@ class ConfigTest extends TestCase
|
|||
'cache-dir' => 's3://baz/',
|
||||
]]);
|
||||
|
||||
$this->assertEquals('s3://baz', $config->get('cache-dir'));
|
||||
self::assertEquals('s3://baz', $config->get('cache-dir'));
|
||||
}
|
||||
|
||||
public function testFetchingRelativePaths(): void
|
||||
|
@ -218,10 +218,10 @@ class ConfigTest extends TestCase
|
|||
'vendor-dir' => 'vendor',
|
||||
]]);
|
||||
|
||||
$this->assertEquals('/foo/bar/vendor', $config->get('vendor-dir'));
|
||||
$this->assertEquals('/foo/bar/vendor/foo', $config->get('bin-dir'));
|
||||
$this->assertEquals('vendor', $config->get('vendor-dir', Config::RELATIVE_PATHS));
|
||||
$this->assertEquals('vendor/foo', $config->get('bin-dir', Config::RELATIVE_PATHS));
|
||||
self::assertEquals('/foo/bar/vendor', $config->get('vendor-dir'));
|
||||
self::assertEquals('/foo/bar/vendor/foo', $config->get('bin-dir'));
|
||||
self::assertEquals('vendor', $config->get('vendor-dir', Config::RELATIVE_PATHS));
|
||||
self::assertEquals('vendor/foo', $config->get('bin-dir', Config::RELATIVE_PATHS));
|
||||
}
|
||||
|
||||
public function testOverrideGithubProtocols(): void
|
||||
|
@ -230,17 +230,17 @@ class ConfigTest extends TestCase
|
|||
$config->merge(['config' => ['github-protocols' => ['https', 'ssh']]]);
|
||||
$config->merge(['config' => ['github-protocols' => ['https']]]);
|
||||
|
||||
$this->assertEquals(['https'], $config->get('github-protocols'));
|
||||
self::assertEquals(['https'], $config->get('github-protocols'));
|
||||
}
|
||||
|
||||
public function testGitDisabledByDefaultInGithubProtocols(): void
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(['config' => ['github-protocols' => ['https', 'git']]]);
|
||||
$this->assertEquals(['https'], $config->get('github-protocols'));
|
||||
self::assertEquals(['https'], $config->get('github-protocols'));
|
||||
|
||||
$config->merge(['config' => ['secure-http' => false]]);
|
||||
$this->assertEquals(['https', 'git'], $config->get('github-protocols'));
|
||||
self::assertEquals(['https', 'git'], $config->get('github-protocols'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,11 +330,11 @@ class ConfigTest extends TestCase
|
|||
$config->merge(
|
||||
['config' => ['disable-tls' => 'false']]
|
||||
);
|
||||
$this->assertFalse($config->get('disable-tls'));
|
||||
self::assertFalse($config->get('disable-tls'));
|
||||
$config->merge(
|
||||
['config' => ['disable-tls' => 'true']]
|
||||
);
|
||||
$this->assertTrue($config->get('disable-tls'));
|
||||
self::assertTrue($config->get('disable-tls'));
|
||||
}
|
||||
|
||||
public function testProcessTimeout(): void
|
||||
|
@ -344,7 +344,7 @@ class ConfigTest extends TestCase
|
|||
$result = $config->get('process-timeout');
|
||||
Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT');
|
||||
|
||||
$this->assertEquals(0, $result);
|
||||
self::assertEquals(0, $result);
|
||||
}
|
||||
|
||||
public function testHtaccessProtect(): void
|
||||
|
@ -354,7 +354,7 @@ class ConfigTest extends TestCase
|
|||
$result = $config->get('htaccess-protect');
|
||||
Platform::clearEnv('COMPOSER_HTACCESS_PROTECT');
|
||||
|
||||
$this->assertEquals(0, $result);
|
||||
self::assertEquals(0, $result);
|
||||
}
|
||||
|
||||
public function testGetSourceOfValue(): void
|
||||
|
@ -363,14 +363,14 @@ class ConfigTest extends TestCase
|
|||
|
||||
$config = new Config;
|
||||
|
||||
$this->assertSame(Config::SOURCE_DEFAULT, $config->getSourceOfValue('process-timeout'));
|
||||
self::assertSame(Config::SOURCE_DEFAULT, $config->getSourceOfValue('process-timeout'));
|
||||
|
||||
$config->merge(
|
||||
['config' => ['process-timeout' => 1]],
|
||||
'phpunit-test'
|
||||
);
|
||||
|
||||
$this->assertSame('phpunit-test', $config->getSourceOfValue('process-timeout'));
|
||||
self::assertSame('phpunit-test', $config->getSourceOfValue('process-timeout'));
|
||||
}
|
||||
|
||||
public function testGetSourceOfValueEnvVariables(): void
|
||||
|
@ -380,7 +380,7 @@ class ConfigTest extends TestCase
|
|||
$result = $config->getSourceOfValue('htaccess-protect');
|
||||
Platform::clearEnv('COMPOSER_HTACCESS_PROTECT');
|
||||
|
||||
$this->assertEquals('COMPOSER_HTACCESS_PROTECT', $result);
|
||||
self::assertEquals('COMPOSER_HTACCESS_PROTECT', $result);
|
||||
}
|
||||
|
||||
public function testAudit(): void
|
||||
|
@ -420,8 +420,8 @@ class ConfigTest extends TestCase
|
|||
];
|
||||
foreach ($keys as $key) {
|
||||
$value = $config->get($key);
|
||||
$this->assertIsArray($value); // @phpstan-ignore staticMethod.dynamicCall (- PHPStan knows that its an array for all given keys)
|
||||
$this->assertCount(0, $value);
|
||||
self::assertIsArray($value);
|
||||
self::assertCount(0, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,29 +429,29 @@ class ConfigTest extends TestCase
|
|||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(['config' => ['allow-plugins' => ['some/plugin' => true]]]);
|
||||
$this->assertEquals(['some/plugin' => true], $config->get('allow-plugins'));
|
||||
self::assertEquals(['some/plugin' => true], $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(['config' => ['allow-plugins' => ['another/plugin' => true]]]);
|
||||
$this->assertEquals(['some/plugin' => true, 'another/plugin' => true], $config->get('allow-plugins'));
|
||||
self::assertEquals(['some/plugin' => true, 'another/plugin' => true], $config->get('allow-plugins'));
|
||||
}
|
||||
|
||||
public function testOverridesGlobalBooleanPluginsConfig(): void
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(['config' => ['allow-plugins' => true]]);
|
||||
$this->assertEquals(true, $config->get('allow-plugins'));
|
||||
self::assertEquals(true, $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(['config' => ['allow-plugins' => ['another/plugin' => true]]]);
|
||||
$this->assertEquals(['another/plugin' => true], $config->get('allow-plugins'));
|
||||
self::assertEquals(['another/plugin' => true], $config->get('allow-plugins'));
|
||||
}
|
||||
|
||||
public function testAllowsAllPluginsFromLocalBoolean(): void
|
||||
{
|
||||
$config = new Config(false);
|
||||
$config->merge(['config' => ['allow-plugins' => ['some/plugin' => true]]]);
|
||||
$this->assertEquals(['some/plugin' => true], $config->get('allow-plugins'));
|
||||
self::assertEquals(['some/plugin' => true], $config->get('allow-plugins'));
|
||||
|
||||
$config->merge(['config' => ['allow-plugins' => true]]);
|
||||
$this->assertEquals(true, $config->get('allow-plugins'));
|
||||
self::assertEquals(true, $config->get('allow-plugins'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class HtmlOutputFormatterTest extends TestCase
|
|||
'warning' => new OutputFormatterStyle('black', 'yellow'),
|
||||
]);
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
'text <span style="color:green;">green</span> <span style="color:yellow;">yellow</span> <span style="color:black;background-color:yellow;">black w/ yello bg</span>',
|
||||
$formatter->format('text <info>green</info> <comment>yellow</comment> <warning>black w/ yello bg</warning>')
|
||||
);
|
||||
|
|
|
@ -22,6 +22,6 @@ class DefaultConfigTest extends TestCase
|
|||
public function testDefaultValuesAreAsExpected(): void
|
||||
{
|
||||
$config = new Config;
|
||||
$this->assertFalse($config->get('disable-tls'));
|
||||
self::assertFalse($config->get('disable-tls'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewest(): void
|
||||
|
@ -69,7 +69,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestPicksLatest(): void
|
||||
|
@ -85,7 +85,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestPicksLatestStableWithPreferStable(): void
|
||||
|
@ -102,7 +102,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$policy = new DefaultPolicy(true);
|
||||
$selected = $policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestWithDevPicksNonDev(): void
|
||||
|
@ -118,7 +118,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestWithPreferredVersionPicksPreferredVersionIfAvailable(): void
|
||||
|
@ -137,7 +137,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$policy = new DefaultPolicy(false, false, ['a' => '1.1.0.0']);
|
||||
$selected = $policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestWithPreferredVersionPicksNewestOtherwise(): void
|
||||
|
@ -154,7 +154,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$policy = new DefaultPolicy(false, false, ['a' => '1.1.0.0']);
|
||||
$selected = $policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectNewestWithPreferredVersionPicksLowestIfPreferLowest(): void
|
||||
|
@ -171,7 +171,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$policy = new DefaultPolicy(false, true, ['a' => '1.1.0.0']);
|
||||
$selected = $policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testRepositoryOrderingAffectsPriority(): void
|
||||
|
@ -193,7 +193,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$expected = [$package2->getId()];
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
|
||||
$this->repositorySet = new RepositorySet('dev');
|
||||
$this->repositorySet->addRepository($repo2);
|
||||
|
@ -204,7 +204,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$expected = [$package4->getId()];
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectLocalReposFirst(): void
|
||||
|
@ -235,7 +235,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectAllProviders(): void
|
||||
|
@ -255,7 +255,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testPreferNonReplacingFromSameRepo(): void
|
||||
|
@ -274,7 +274,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testPreferReplacingPackageFromSameVendor(): void
|
||||
|
@ -294,7 +294,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$expected = $literals;
|
||||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals, 'vendor-a/package');
|
||||
$this->assertEquals($expected, $selected);
|
||||
self::assertEquals($expected, $selected);
|
||||
|
||||
// test with reversed order in repo
|
||||
$repo = new ArrayRepository;
|
||||
|
@ -310,7 +310,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$expected = $literals;
|
||||
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals, 'vendor-a/package');
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
|
||||
public function testSelectLowest(): void
|
||||
|
@ -328,6 +328,6 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$selected = $policy->selectPreferredPackages($pool, $literals);
|
||||
|
||||
$this->assertSame($expected, $selected);
|
||||
self::assertSame($expected, $selected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,13 +139,13 @@ class PoolBuilderTest extends TestCase
|
|||
|
||||
sort($expect);
|
||||
sort($result);
|
||||
$this->assertSame($expect, $result, 'Unoptimized pool does not match expected package set');
|
||||
self::assertSame($expect, $result, 'Unoptimized pool does not match expected package set');
|
||||
|
||||
$optimizer = new PoolOptimizer(new DefaultPolicy());
|
||||
$result = $this->getPackageResultSet($optimizer->optimize($request, $pool), $packageIds);
|
||||
sort($expectOptimized);
|
||||
sort($result);
|
||||
$this->assertSame($expectOptimized, $result, 'Optimized pool does not match expected package set');
|
||||
self::assertSame($expectOptimized, $result, 'Optimized pool does not match expected package set');
|
||||
|
||||
chdir($oldCwd);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class PoolOptimizerTest extends TestCase
|
|||
|
||||
$pool = $poolOptimizer->optimize($request, $pool);
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
$this->reducePackagesInfoForComparison($expectedPackages),
|
||||
$this->reducePackagesInfoForComparison($pool->getPackages()),
|
||||
$message
|
||||
|
|
|
@ -23,8 +23,8 @@ class PoolTest extends TestCase
|
|||
|
||||
$pool = $this->createPool([$package]);
|
||||
|
||||
$this->assertEquals([$package], $pool->whatProvides('foo'));
|
||||
$this->assertEquals([$package], $pool->whatProvides('foo'));
|
||||
self::assertEquals([$package], $pool->whatProvides('foo'));
|
||||
self::assertEquals([$package], $pool->whatProvides('foo'));
|
||||
}
|
||||
|
||||
public function testWhatProvidesPackageWithConstraint(): void
|
||||
|
@ -37,8 +37,8 @@ class PoolTest extends TestCase
|
|||
$secondPackage,
|
||||
]);
|
||||
|
||||
$this->assertEquals([$firstPackage, $secondPackage], $pool->whatProvides('foo'));
|
||||
$this->assertEquals([$secondPackage], $pool->whatProvides('foo', self::getVersionConstraint('==', '2')));
|
||||
self::assertEquals([$firstPackage, $secondPackage], $pool->whatProvides('foo'));
|
||||
self::assertEquals([$secondPackage], $pool->whatProvides('foo', self::getVersionConstraint('==', '2')));
|
||||
}
|
||||
|
||||
public function testPackageById(): void
|
||||
|
@ -47,14 +47,14 @@ class PoolTest extends TestCase
|
|||
|
||||
$pool = $this->createPool([$package]);
|
||||
|
||||
$this->assertSame($package, $pool->packageById(1));
|
||||
self::assertSame($package, $pool->packageById(1));
|
||||
}
|
||||
|
||||
public function testWhatProvidesWhenPackageCannotBeFound(): void
|
||||
{
|
||||
$pool = $this->createPool();
|
||||
|
||||
$this->assertEquals([], $pool->whatProvides('foo'));
|
||||
self::assertEquals([], $pool->whatProvides('foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@ class RequestTest extends TestCase
|
|||
$request = new Request();
|
||||
$request->requireName('foo');
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
[
|
||||
'foo' => new MatchAllConstraint(),
|
||||
],
|
||||
|
@ -55,7 +55,7 @@ class RequestTest extends TestCase
|
|||
$request = new Request();
|
||||
$request->requireName('foo', $constraint = self::getVersionConstraint('=', '1'));
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
[
|
||||
'foo' => $constraint,
|
||||
],
|
||||
|
|
|
@ -58,7 +58,7 @@ class RuleSetIteratorTest extends TestCase
|
|||
$this->rules[RuleSet::TYPE_LEARNED][0],
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
self::assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function testKeys(): void
|
||||
|
@ -76,6 +76,6 @@ class RuleSetIteratorTest extends TestCase
|
|||
RuleSet::TYPE_LEARNED,
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
self::assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class RuleSetTest extends TestCase
|
|||
$ruleSet->add($rules[RuleSet::TYPE_LEARNED][0], RuleSet::TYPE_LEARNED);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_REQUEST][1], RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertEquals($rules, $ruleSet->getRules());
|
||||
self::assertEquals($rules, $ruleSet->getRules());
|
||||
}
|
||||
|
||||
public function testAddIgnoresDuplicates(): void
|
||||
|
@ -60,7 +60,7 @@ class RuleSetTest extends TestCase
|
|||
$ruleSet->add($rules[RuleSet::TYPE_REQUEST][1], RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_REQUEST][2], RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertCount(1, $ruleSet->getIteratorFor([RuleSet::TYPE_REQUEST]));
|
||||
self::assertCount(1, $ruleSet->getIteratorFor([RuleSet::TYPE_REQUEST]));
|
||||
}
|
||||
|
||||
public function testAddWhenTypeIsNotRecognized(): void
|
||||
|
@ -79,7 +79,7 @@ class RuleSetTest extends TestCase
|
|||
$ruleSet->add(new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add(new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertEquals(2, $ruleSet->count());
|
||||
self::assertEquals(2, $ruleSet->count());
|
||||
}
|
||||
|
||||
public function testRuleById(): void
|
||||
|
@ -89,7 +89,7 @@ class RuleSetTest extends TestCase
|
|||
$rule = new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$ruleSet->add($rule, RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertSame($rule, $ruleSet->ruleById[0]);
|
||||
self::assertSame($rule, $ruleSet->ruleById[0]);
|
||||
}
|
||||
|
||||
public function testGetIterator(): void
|
||||
|
@ -103,9 +103,9 @@ class RuleSetTest extends TestCase
|
|||
|
||||
$iterator = $ruleSet->getIterator();
|
||||
|
||||
$this->assertSame($rule1, $iterator->current());
|
||||
self::assertSame($rule1, $iterator->current());
|
||||
$iterator->next();
|
||||
$this->assertSame($rule2, $iterator->current());
|
||||
self::assertSame($rule2, $iterator->current());
|
||||
}
|
||||
|
||||
public function testGetIteratorFor(): void
|
||||
|
@ -119,7 +119,7 @@ class RuleSetTest extends TestCase
|
|||
|
||||
$iterator = $ruleSet->getIteratorFor(RuleSet::TYPE_LEARNED);
|
||||
|
||||
$this->assertSame($rule2, $iterator->current());
|
||||
self::assertSame($rule2, $iterator->current());
|
||||
}
|
||||
|
||||
public function testGetIteratorWithout(): void
|
||||
|
@ -133,7 +133,7 @@ class RuleSetTest extends TestCase
|
|||
|
||||
$iterator = $ruleSet->getIteratorWithout(RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertSame($rule2, $iterator->current());
|
||||
self::assertSame($rule2, $iterator->current());
|
||||
}
|
||||
|
||||
public function testPrettyString(): void
|
||||
|
@ -151,6 +151,6 @@ class RuleSetTest extends TestCase
|
|||
|
||||
$ruleSet->add($rule, RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertStringContainsString('REQUEST : No package found to satisfy root composer.json require foo/bar', $ruleSet->getPrettyString($repositorySetMock, $requestMock, $pool));
|
||||
self::assertStringContainsString('REQUEST : No package found to satisfy root composer.json require foo/bar', $ruleSet->getPrettyString($repositorySetMock, $requestMock, $pool));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([123], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$hash = unpack('ihash', md5('123', true));
|
||||
$this->assertEquals($hash['hash'], $rule->getHash());
|
||||
self::assertEquals($hash['hash'], $rule->getHash());
|
||||
}
|
||||
|
||||
public function testEqualsForRulesWithDifferentHashes(): void
|
||||
|
@ -35,7 +35,7 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([1, 2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([1, 3], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$this->assertFalse($rule->equals($rule2));
|
||||
self::assertFalse($rule->equals($rule2));
|
||||
}
|
||||
|
||||
public function testEqualsForRulesWithDifferLiteralsQuantity(): void
|
||||
|
@ -43,7 +43,7 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([1, 12], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$this->assertFalse($rule->equals($rule2));
|
||||
self::assertFalse($rule->equals($rule2));
|
||||
}
|
||||
|
||||
public function testEqualsForRulesWithSameLiterals(): void
|
||||
|
@ -51,7 +51,7 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([1, 12], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([1, 12], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$this->assertTrue($rule->equals($rule2));
|
||||
self::assertTrue($rule->equals($rule2));
|
||||
}
|
||||
|
||||
public function testSetAndGetType(): void
|
||||
|
@ -59,7 +59,7 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule->setType(RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertEquals(RuleSet::TYPE_REQUEST, $rule->getType());
|
||||
self::assertEquals(RuleSet::TYPE_REQUEST, $rule->getType());
|
||||
}
|
||||
|
||||
public function testEnable(): void
|
||||
|
@ -68,8 +68,8 @@ class RuleTest extends TestCase
|
|||
$rule->disable();
|
||||
$rule->enable();
|
||||
|
||||
$this->assertTrue($rule->isEnabled());
|
||||
$this->assertFalse($rule->isDisabled());
|
||||
self::assertTrue($rule->isEnabled());
|
||||
self::assertFalse($rule->isDisabled());
|
||||
}
|
||||
|
||||
public function testDisable(): void
|
||||
|
@ -78,8 +78,8 @@ class RuleTest extends TestCase
|
|||
$rule->enable();
|
||||
$rule->disable();
|
||||
|
||||
$this->assertTrue($rule->isDisabled());
|
||||
$this->assertFalse($rule->isEnabled());
|
||||
self::assertTrue($rule->isDisabled());
|
||||
self::assertFalse($rule->isEnabled());
|
||||
}
|
||||
|
||||
public function testIsAssertions(): void
|
||||
|
@ -87,8 +87,8 @@ class RuleTest extends TestCase
|
|||
$rule = new GenericRule([1, 12], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$this->assertFalse($rule->isAssertion());
|
||||
$this->assertTrue($rule2->isAssertion());
|
||||
self::assertFalse($rule->isAssertion());
|
||||
self::assertTrue($rule2->isAssertion());
|
||||
}
|
||||
|
||||
public function testPrettyString(): void
|
||||
|
@ -106,6 +106,6 @@ class RuleTest extends TestCase
|
|||
|
||||
$rule = new GenericRule([$p1->getId(), -$p2->getId()], Rule::RULE_PACKAGE_REQUIRES, new Link('baz', 'foo', $emptyConstraint));
|
||||
|
||||
$this->assertEquals('baz 1.1 relates to foo * -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock, $pool, false));
|
||||
self::assertEquals('baz 1.1 relates to foo * -> satisfiable by foo[2.1].', $rule->getPrettyString($repositorySetMock, $requestMock, $pool, false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@ class SolverTest extends TestCase
|
|||
$this->fail('Unsolvable conflict did not result in exception.');
|
||||
} catch (SolverProblemsException $e) {
|
||||
$problems = $e->getProblems();
|
||||
$this->assertCount(1, $problems);
|
||||
$this->assertEquals(2, $e->getCode());
|
||||
$this->assertEquals("\n - Root composer.json requires b, it could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
self::assertCount(1, $problems);
|
||||
self::assertEquals(2, $e->getCode());
|
||||
self::assertEquals("\n - Root composer.json requires b, it could not be found in any version, there may be a typo in the package name.", $problems[0]->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -772,14 +772,14 @@ class SolverTest extends TestCase
|
|||
$this->fail('Unsolvable conflict did not result in exception.');
|
||||
} catch (SolverProblemsException $e) {
|
||||
$problems = $e->getProblems();
|
||||
$this->assertCount(1, $problems);
|
||||
self::assertCount(1, $problems);
|
||||
|
||||
$msg = "\n";
|
||||
$msg .= " Problem 1\n";
|
||||
$msg .= " - Root composer.json requires a * -> satisfiable by A[1.0].\n";
|
||||
$msg .= " - A 1.0 conflicts with B 1.0.\n";
|
||||
$msg .= " - Root composer.json requires b * -> satisfiable by B[1.0].\n";
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
self::assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,14 +802,14 @@ class SolverTest extends TestCase
|
|||
$this->fail('Unsolvable conflict did not result in exception.');
|
||||
} catch (SolverProblemsException $e) {
|
||||
$problems = $e->getProblems();
|
||||
$this->assertCount(1, $problems);
|
||||
self::assertCount(1, $problems);
|
||||
// TODO assert problem properties
|
||||
|
||||
$msg = "\n";
|
||||
$msg .= " Problem 1\n";
|
||||
$msg .= " - Root composer.json requires a * -> satisfiable by A[1.0].\n";
|
||||
$msg .= " - A 1.0 requires b >= 2.0 -> found B[1.0] but it does not match the constraint.\n";
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
self::assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,7 +847,7 @@ class SolverTest extends TestCase
|
|||
$this->fail('Unsolvable conflict did not result in exception.');
|
||||
} catch (SolverProblemsException $e) {
|
||||
$problems = $e->getProblems();
|
||||
$this->assertCount(1, $problems);
|
||||
self::assertCount(1, $problems);
|
||||
|
||||
$msg = "\n";
|
||||
$msg .= " Problem 1\n";
|
||||
|
@ -857,7 +857,7 @@ class SolverTest extends TestCase
|
|||
$msg .= " - You can only install one version of a package, so only one of these can be installed: B[0.9, 1.0].\n";
|
||||
$msg .= " - A 1.0 requires b >= 1.0 -> satisfiable by B[1.0].\n";
|
||||
$msg .= " - Root composer.json requires a * -> satisfiable by A[1.0].\n";
|
||||
$this->assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
self::assertEquals($msg, $e->getPrettyString($this->repoSet, $this->request, $this->pool, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ class SolverTest extends TestCase
|
|||
$this->createSolver();
|
||||
|
||||
// check correct setup for assertion later
|
||||
$this->assertFalse($this->solver->testFlagLearnedPositiveLiteral);
|
||||
self::assertFalse($this->solver->testFlagLearnedPositiveLiteral);
|
||||
|
||||
$this->checkSolverResult([
|
||||
['job' => 'install', 'package' => $packageF1],
|
||||
|
@ -1037,7 +1037,7 @@ class SolverTest extends TestCase
|
|||
|
||||
// verify that the code path leading to a negative literal resulting in a positive learned literal is actually
|
||||
// executed
|
||||
$this->assertTrue($this->solver->testFlagLearnedPositiveLiteral);
|
||||
self::assertTrue($this->solver->testFlagLearnedPositiveLiteral);
|
||||
}
|
||||
|
||||
protected function reposComplete(): void
|
||||
|
@ -1094,7 +1094,7 @@ class SolverTest extends TestCase
|
|||
$resultReadable[] = array_map('strval', $op);
|
||||
}
|
||||
|
||||
$this->assertEquals($expectedReadable, $resultReadable);
|
||||
$this->assertEquals($expected, $result);
|
||||
self::assertEquals($expectedReadable, $resultReadable);
|
||||
self::assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,6 @@ class TransactionTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
self::assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ class ArchiveDownloaderTest extends TestCase
|
|||
->will($this->returnValue('/vendor'));
|
||||
|
||||
$first = $method->invoke($downloader, $packageMock, '/path');
|
||||
$this->assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $first);
|
||||
$this->assertSame($first, $method->invoke($downloader, $packageMock, '/path'));
|
||||
self::assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $first);
|
||||
self::assertSame($first, $method->invoke($downloader, $packageMock, '/path'));
|
||||
}
|
||||
|
||||
public function testProcessUrl(): void
|
||||
|
@ -54,7 +54,7 @@ class ArchiveDownloaderTest extends TestCase
|
|||
$expected = 'https://github.com/composer/composer/zipball/master';
|
||||
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
|
||||
|
||||
$this->assertEquals($expected, $url);
|
||||
self::assertEquals($expected, $url);
|
||||
}
|
||||
|
||||
public function testProcessUrl2(): void
|
||||
|
@ -70,7 +70,7 @@ class ArchiveDownloaderTest extends TestCase
|
|||
$expected = 'https://github.com/composer/composer/archive/master.tar.gz';
|
||||
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
|
||||
|
||||
$this->assertEquals($expected, $url);
|
||||
self::assertEquals($expected, $url);
|
||||
}
|
||||
|
||||
public function testProcessUrl3(): void
|
||||
|
@ -86,7 +86,7 @@ class ArchiveDownloaderTest extends TestCase
|
|||
$expected = 'https://api.github.com/repos/composer/composer/zipball/master';
|
||||
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
|
||||
|
||||
$this->assertEquals($expected, $url);
|
||||
self::assertEquals($expected, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,7 +111,7 @@ class ArchiveDownloaderTest extends TestCase
|
|||
->will($this->returnValue('ref'));
|
||||
$url = $method->invoke($downloader, $package, $url);
|
||||
|
||||
$this->assertEquals($expected, $url);
|
||||
self::assertEquals($expected, $url);
|
||||
}
|
||||
|
||||
public static function provideUrls(): array
|
||||
|
@ -148,7 +148,7 @@ class ArchiveDownloaderTest extends TestCase
|
|||
->will($this->returnValue('ref'));
|
||||
$url = $method->invoke($downloader, $package, $url);
|
||||
|
||||
$this->assertEquals($expected, $url);
|
||||
self::assertEquals($expected, $url);
|
||||
}
|
||||
|
||||
public static function provideBitbucketUrls(): array
|
||||
|
|
|
@ -36,7 +36,7 @@ class DownloadManagerTest extends TestCase
|
|||
$manager = new DownloadManager($this->io, false, $this->filesystem);
|
||||
|
||||
$manager->setDownloader('test', $downloader);
|
||||
$this->assertSame($downloader, $manager->getDownloader('test'));
|
||||
self::assertSame($downloader, $manager->getDownloader('test'));
|
||||
|
||||
self::expectException('InvalidArgumentException');
|
||||
$manager->getDownloader('unregistered');
|
||||
|
@ -86,7 +86,7 @@ class DownloadManagerTest extends TestCase
|
|||
->with('pear')
|
||||
->will($this->returnValue($downloader));
|
||||
|
||||
$this->assertSame($downloader, $manager->getDownloaderForPackage($package));
|
||||
self::assertSame($downloader, $manager->getDownloaderForPackage($package));
|
||||
}
|
||||
|
||||
public function testGetDownloaderForIncorrectlyInstalledDistPackage(): void
|
||||
|
@ -152,7 +152,7 @@ class DownloadManagerTest extends TestCase
|
|||
->with('git')
|
||||
->will($this->returnValue($downloader));
|
||||
|
||||
$this->assertSame($downloader, $manager->getDownloaderForPackage($package));
|
||||
self::assertSame($downloader, $manager->getDownloaderForPackage($package));
|
||||
}
|
||||
|
||||
public function testGetDownloaderForIncorrectlyInstalledSourcePackage(): void
|
||||
|
@ -199,7 +199,7 @@ class DownloadManagerTest extends TestCase
|
|||
|
||||
$manager = new DownloadManager($this->io, false, $this->filesystem);
|
||||
|
||||
$this->assertNull($manager->getDownloaderForPackage($package));
|
||||
self::assertNull($manager->getDownloaderForPackage($package));
|
||||
}
|
||||
|
||||
public function testFullPackageDownload(): void
|
||||
|
@ -264,7 +264,7 @@ class DownloadManagerTest extends TestCase
|
|||
'source',
|
||||
];
|
||||
|
||||
$this->assertSame(array_shift($series), $type);
|
||||
self::assertSame(array_shift($series), $type);
|
||||
});
|
||||
|
||||
$downloaderFail = $this->createDownloaderMock();
|
||||
|
@ -674,7 +674,7 @@ class DownloadManagerTest extends TestCase
|
|||
$manager = new DownloadManager($this->io, false, $this->filesystem);
|
||||
$method = new \ReflectionMethod($manager, 'getAvailableSources');
|
||||
$method->setAccessible(true);
|
||||
$this->assertEquals($expected, $method->invoke($manager, $target, $initial ?? null));
|
||||
self::assertEquals($expected, $method->invoke($manager, $target, $initial ?? null));
|
||||
}
|
||||
|
||||
public static function updatesProvider(): array
|
||||
|
|
|
@ -81,8 +81,8 @@ class FileDownloaderTest extends TestCase
|
|||
} elseif (is_file($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
$this->assertInstanceOf('RuntimeException', $e);
|
||||
$this->assertStringContainsString('exists and is not a directory', $e->getMessage());
|
||||
self::assertInstanceOf('RuntimeException', $e);
|
||||
self::assertStringContainsString('exists and is not a directory', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class FileDownloaderTest extends TestCase
|
|||
$method = new \ReflectionMethod($downloader, 'getFileName');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$this->assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $package, '/path'));
|
||||
self::assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $package, '/path'));
|
||||
}
|
||||
|
||||
public function testDownloadButFileIsUnsaved(): void
|
||||
|
@ -134,8 +134,8 @@ class FileDownloaderTest extends TestCase
|
|||
unlink($path);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
$this->assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
self::assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
self::assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('copyTo')
|
||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||
self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||
|
||||
return false;
|
||||
}));
|
||||
|
@ -184,7 +184,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('copyFrom')
|
||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||
self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||
|
||||
return false;
|
||||
}));
|
||||
|
@ -194,7 +194,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('addCopy')
|
||||
->will($this->returnCallback(function ($url) use ($expectedUrl) {
|
||||
$this->assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
self::assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
|
||||
return \React\Promise\resolve(
|
||||
new Response(['url' => 'http://example.org/'], 200, [], 'file~')
|
||||
|
@ -217,8 +217,8 @@ class FileDownloaderTest extends TestCase
|
|||
unlink($path);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
$this->assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
self::assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
self::assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('copyTo')
|
||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||
self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||
|
||||
return false;
|
||||
}));
|
||||
|
@ -268,7 +268,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('copyFrom')
|
||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||
self::assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||
|
||||
return false;
|
||||
}));
|
||||
|
@ -278,7 +278,7 @@ class FileDownloaderTest extends TestCase
|
|||
->expects($this->any())
|
||||
->method('addCopy')
|
||||
->will($this->returnCallback(function ($url) use ($expectedUrl) {
|
||||
$this->assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
self::assertEquals($expectedUrl, $url, 'Failed assertion on $url argument of HttpDownloader::addCopy method:');
|
||||
|
||||
return \React\Promise\resolve(
|
||||
new Response(['url' => 'http://example.org/'], 200, [], 'file~')
|
||||
|
@ -301,8 +301,8 @@ class FileDownloaderTest extends TestCase
|
|||
unlink($path);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
$this->assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
self::assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
self::assertStringContainsString('could not be saved to', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,8 +364,8 @@ class FileDownloaderTest extends TestCase
|
|||
unlink($path);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
$this->assertStringContainsString('checksum verification', $e->getMessage());
|
||||
self::assertInstanceOf('UnexpectedValueException', $e, $e->getMessage());
|
||||
self::assertStringContainsString('checksum verification', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,6 +162,6 @@ class FossilDownloaderTest extends TestCase
|
|||
{
|
||||
$downloader = $this->getDownloaderMock(null);
|
||||
|
||||
$this->assertEquals('source', $downloader->getInstallationSource());
|
||||
self::assertEquals('source', $downloader->getInstallationSource());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ class GitDownloaderTest extends TestCase
|
|||
if ('RuntimeException' !== get_class($e)) {
|
||||
throw $e;
|
||||
}
|
||||
$this->assertEquals('RuntimeException', get_class($e));
|
||||
self::assertEquals('RuntimeException', get_class($e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ composer https://github.com/old/url (push)
|
|||
if ('RuntimeException' !== get_class($e)) {
|
||||
throw $e;
|
||||
}
|
||||
$this->assertEquals('RuntimeException', get_class($e));
|
||||
self::assertEquals('RuntimeException', get_class($e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ composer https://github.com/old/url (push)
|
|||
{
|
||||
$downloader = $this->getDownloaderMock();
|
||||
|
||||
$this->assertEquals('source', $downloader->getInstallationSource());
|
||||
self::assertEquals('source', $downloader->getInstallationSource());
|
||||
}
|
||||
|
||||
private function winCompat(string $cmd): string
|
||||
|
|
|
@ -154,6 +154,6 @@ class HgDownloaderTest extends TestCase
|
|||
{
|
||||
$downloader = $this->getDownloaderMock(null);
|
||||
|
||||
$this->assertEquals('source', $downloader->getInstallationSource());
|
||||
self::assertEquals('source', $downloader->getInstallationSource());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class XzDownloaderTest extends TestCase
|
|||
|
||||
$this->fail('Download of invalid tarball should throw an exception');
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertMatchesRegularExpression('/(File format not recognized|Unrecognized archive format)/i', $e->getMessage());
|
||||
self::assertMatchesRegularExpression('/(File format not recognized|Unrecognized archive format)/i', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class ZipDownloaderTest extends TestCase
|
|||
|
||||
$this->fail('Download of invalid zip files should throw an exception');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertStringContainsString('is not a zip archive', $e->getMessage());
|
||||
self::assertStringContainsString('is not a zip archive', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class EventDispatcherTest extends TestCase
|
|||
.'> ev1: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'.PHP_EOL
|
||||
.'> ev2: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'.PHP_EOL
|
||||
.'> ev2: Composer\Test\EventDispatcher\EventDispatcherTest->someMethod'.PHP_EOL;
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
|
||||
$dispatcher->removeListener($this);
|
||||
$dispatcher->dispatch('ev1');
|
||||
|
@ -208,7 +208,7 @@ class EventDispatcherTest extends TestCase
|
|||
|
||||
$expected .= '> ev1: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'.PHP_EOL
|
||||
.'> ev2: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'.PHP_EOL;
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
}
|
||||
|
||||
public function testDispatcherCanExecuteCliAndPhpInSameEventScriptStack(): void
|
||||
|
@ -245,7 +245,7 @@ class EventDispatcherTest extends TestCase
|
|||
$expected = '> post-install-cmd: echo -n foo'.PHP_EOL.
|
||||
'> post-install-cmd: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'.PHP_EOL.
|
||||
'> post-install-cmd: echo -n bar'.PHP_EOL;
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
}
|
||||
|
||||
public function testDispatcherCanPutEnv(): void
|
||||
|
@ -274,7 +274,7 @@ class EventDispatcherTest extends TestCase
|
|||
|
||||
$expected = '> post-install-cmd: @putenv ABC=123'.PHP_EOL.
|
||||
'> post-install-cmd: Composer\Test\EventDispatcher\EventDispatcherTest::getTestEnv'.PHP_EOL;
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
}
|
||||
|
||||
public function testDispatcherAppendsDirBinOnPathForEveryListener(): void
|
||||
|
@ -386,7 +386,7 @@ class EventDispatcherTest extends TestCase
|
|||
'> group: @subgroup'.PHP_EOL.
|
||||
'> subgroup: echo -n baz'.PHP_EOL.
|
||||
'> group: echo -n bar'.PHP_EOL;
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
}
|
||||
|
||||
public function testRecursionInScriptsNames(): void
|
||||
|
@ -425,7 +425,7 @@ class EventDispatcherTest extends TestCase
|
|||
$expected = "> helloWorld: @hello World".PHP_EOL.
|
||||
"> hello: echo Hello " .self::getCmd("'World'").PHP_EOL;
|
||||
|
||||
$this->assertEquals($expected, $io->getOutput());
|
||||
self::assertEquals($expected, $io->getOutput());
|
||||
}
|
||||
|
||||
public function testDispatcherDetectInfiniteRecursion(): void
|
||||
|
|
|
@ -24,8 +24,8 @@ final class IgnoreAllPlatformRequirementFilterTest extends TestCase
|
|||
{
|
||||
$platformRequirementFilter = new IgnoreAllPlatformRequirementFilter();
|
||||
|
||||
$this->assertSame($expectIgnored, $platformRequirementFilter->isIgnored($req));
|
||||
$this->assertSame($expectIgnored, $platformRequirementFilter->isUpperBoundIgnored($req));
|
||||
self::assertSame($expectIgnored, $platformRequirementFilter->isIgnored($req));
|
||||
self::assertSame($expectIgnored, $platformRequirementFilter->isUpperBoundIgnored($req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ final class IgnoreListPlatformRequirementFilterTest extends TestCase
|
|||
{
|
||||
$platformRequirementFilter = new IgnoreListPlatformRequirementFilter($reqList);
|
||||
|
||||
$this->assertSame($expectIgnored, $platformRequirementFilter->isIgnored($req));
|
||||
self::assertSame($expectIgnored, $platformRequirementFilter->isIgnored($req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ final class IgnoreListPlatformRequirementFilterTest extends TestCase
|
|||
{
|
||||
$platformRequirementFilter = new IgnoreListPlatformRequirementFilter($reqList);
|
||||
|
||||
$this->assertSame($expectIgnored, $platformRequirementFilter->isUpperBoundIgnored($req));
|
||||
self::assertSame($expectIgnored, $platformRequirementFilter->isUpperBoundIgnored($req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,8 @@ final class IgnoreNothingPlatformRequirementFilterTest extends TestCase
|
|||
{
|
||||
$platformRequirementFilter = new IgnoreNothingPlatformRequirementFilter();
|
||||
|
||||
$this->assertFalse($platformRequirementFilter->isIgnored($req)); // @phpstan-ignore staticMethod.dynamicCall
|
||||
$this->assertFalse($platformRequirementFilter->isUpperBoundIgnored($req)); // @phpstan-ignore staticMethod.dynamicCall
|
||||
self::assertFalse($platformRequirementFilter->isIgnored($req));
|
||||
self::assertFalse($platformRequirementFilter->isUpperBoundIgnored($req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@ final class PlatformRequirementFilterFactoryTest extends TestCase
|
|||
*/
|
||||
public function testFromBoolOrList($boolOrList, $expectedInstance): void
|
||||
{
|
||||
$this->assertInstanceOf($expectedInstance, PlatformRequirementFilterFactory::fromBoolOrList($boolOrList));
|
||||
self::assertInstanceOf($expectedInstance, PlatformRequirementFilterFactory::fromBoolOrList($boolOrList));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,13 +52,13 @@ final class PlatformRequirementFilterFactoryTest extends TestCase
|
|||
{
|
||||
$platformRequirementFilter = PlatformRequirementFilterFactory::ignoreAll();
|
||||
|
||||
$this->assertInstanceOf('Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter', $platformRequirementFilter);
|
||||
self::assertInstanceOf('Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter', $platformRequirementFilter);
|
||||
}
|
||||
|
||||
public function testIgnoreNothing(): void
|
||||
{
|
||||
$platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
|
||||
|
||||
$this->assertInstanceOf('Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter', $platformRequirementFilter);
|
||||
self::assertInstanceOf('Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter', $platformRequirementFilter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ class BufferIOTest extends TestCase
|
|||
'',
|
||||
]);
|
||||
|
||||
$this->assertTrue($bufferIO->askConfirmation('Please say yes!', false));
|
||||
$this->assertFalse($bufferIO->askConfirmation('Now please say no!', true));
|
||||
$this->assertSame('default', $bufferIO->ask('Empty string last', 'default'));
|
||||
self::assertTrue($bufferIO->askConfirmation('Please say yes!', false));
|
||||
self::assertFalse($bufferIO->askConfirmation('Now please say no!', true));
|
||||
self::assertSame('default', $bufferIO->ask('Empty string last', 'default'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ class ConsoleIOTest extends TestCase
|
|||
|
||||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
|
||||
|
||||
$this->assertTrue($consoleIO->isInteractive());
|
||||
$this->assertFalse($consoleIO->isInteractive());
|
||||
self::assertTrue($consoleIO->isInteractive());
|
||||
self::assertFalse($consoleIO->isInteractive());
|
||||
}
|
||||
|
||||
public function testWrite(): void
|
||||
|
@ -127,7 +127,7 @@ class ConsoleIOTest extends TestCase
|
|||
}
|
||||
|
||||
if (count($series) > 0) {
|
||||
$this->assertSame(array_shift($series), [$args[0], $args[1]]);
|
||||
self::assertSame(array_shift($series), [$args[0], $args[1]]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -252,7 +252,7 @@ class ConsoleIOTest extends TestCase
|
|||
|
||||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
|
||||
$result = $consoleIO->select('Select item', ["item1", "item2"], 'item1', false, "Error message", true);
|
||||
$this->assertEquals(['1'], $result);
|
||||
self::assertEquals(['1'], $result);
|
||||
}
|
||||
|
||||
public function testSetAndgetAuthentication(): void
|
||||
|
@ -264,7 +264,7 @@ class ConsoleIOTest extends TestCase
|
|||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
|
||||
$consoleIO->setAuthentication('repoName', 'l3l0', 'passwd');
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
['username' => 'l3l0', 'password' => 'passwd'],
|
||||
$consoleIO->getAuthentication('repoName')
|
||||
);
|
||||
|
@ -278,7 +278,7 @@ class ConsoleIOTest extends TestCase
|
|||
|
||||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
|
||||
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
['username' => null, 'password' => null],
|
||||
$consoleIO->getAuthentication('repoName')
|
||||
);
|
||||
|
@ -293,7 +293,7 @@ class ConsoleIOTest extends TestCase
|
|||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
|
||||
$consoleIO->setAuthentication('repoName', 'l3l0', 'passwd');
|
||||
|
||||
$this->assertTrue($consoleIO->hasAuthentication('repoName'));
|
||||
$this->assertFalse($consoleIO->hasAuthentication('repoName2'));
|
||||
self::assertTrue($consoleIO->hasAuthentication('repoName'));
|
||||
self::assertFalse($consoleIO->hasAuthentication('repoName2'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,51 +21,51 @@ class NullIOTest extends TestCase
|
|||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertFalse($io->isInteractive());
|
||||
self::assertFalse($io->isInteractive());
|
||||
}
|
||||
|
||||
public function testhasAuthentication(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertFalse($io->hasAuthentication('foo'));
|
||||
self::assertFalse($io->hasAuthentication('foo'));
|
||||
}
|
||||
|
||||
public function testAskAndHideAnswer(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertNull($io->askAndHideAnswer('foo'));
|
||||
self::assertNull($io->askAndHideAnswer('foo'));
|
||||
}
|
||||
|
||||
public function testgetAuthentications(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertIsArray($io->getAuthentications()); // @phpstan-ignore staticMethod.dynamicCall
|
||||
$this->assertEmpty($io->getAuthentications());
|
||||
$this->assertEquals(['username' => null, 'password' => null], $io->getAuthentication('foo'));
|
||||
self::assertIsArray($io->getAuthentications());
|
||||
self::assertEmpty($io->getAuthentications());
|
||||
self::assertEquals(['username' => null, 'password' => null], $io->getAuthentication('foo'));
|
||||
}
|
||||
|
||||
public function testAsk(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertEquals('foo', $io->ask('bar', 'foo'));
|
||||
self::assertEquals('foo', $io->ask('bar', 'foo'));
|
||||
}
|
||||
|
||||
public function testAskConfirmation(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertEquals(false, $io->askConfirmation('bar', false));
|
||||
self::assertEquals(false, $io->askConfirmation('bar', false));
|
||||
}
|
||||
|
||||
public function testAskAndValidate(): void
|
||||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertEquals('foo', $io->askAndValidate('question', static function ($x): bool {
|
||||
self::assertEquals('foo', $io->askAndValidate('question', static function ($x): bool {
|
||||
return true;
|
||||
}, null, 'foo'));
|
||||
}
|
||||
|
@ -74,6 +74,6 @@ class NullIOTest extends TestCase
|
|||
{
|
||||
$io = new NullIO();
|
||||
|
||||
$this->assertEquals('1', $io->select('question', ['item1', 'item2'], '1', 2, 'foo', true));
|
||||
self::assertEquals('1', $io->select('question', ['item1', 'item2'], '1', 2, 'foo', true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class InstalledVersionsTest extends TestCase
|
|||
'foo/replaced',
|
||||
'meta/package',
|
||||
];
|
||||
$this->assertSame($names, InstalledVersions::getInstalledPackages());
|
||||
self::assertSame($names, InstalledVersions::getInstalledPackages());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testIsInstalled(bool $expected, string $name, bool $includeDevRequirements = true): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements));
|
||||
self::assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements));
|
||||
}
|
||||
|
||||
public static function isInstalledProvider(): array
|
||||
|
@ -95,7 +95,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testSatisfies(bool $expected, string $name, string $constraint): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint));
|
||||
self::assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint));
|
||||
}
|
||||
|
||||
public static function satisfiesProvider(): array
|
||||
|
@ -133,7 +133,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testGetVersionRanges(string $expected, string $name): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::getVersionRanges($name));
|
||||
self::assertSame($expected, InstalledVersions::getVersionRanges($name));
|
||||
}
|
||||
|
||||
public static function getVersionRangesProvider(): array
|
||||
|
@ -155,7 +155,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testGetVersion(?string $expected, string $name): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::getVersion($name));
|
||||
self::assertSame($expected, InstalledVersions::getVersion($name));
|
||||
}
|
||||
|
||||
public static function getVersionProvider(): array
|
||||
|
@ -177,7 +177,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testGetPrettyVersion(?string $expected, string $name): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::getPrettyVersion($name));
|
||||
self::assertSame($expected, InstalledVersions::getPrettyVersion($name));
|
||||
}
|
||||
|
||||
public static function getPrettyVersionProvider(): array
|
||||
|
@ -202,7 +202,7 @@ class InstalledVersionsTest extends TestCase
|
|||
|
||||
public function testGetRootPackage(): void
|
||||
{
|
||||
$this->assertSame([
|
||||
self::assertSame([
|
||||
'name' => '__root__',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
|
@ -222,7 +222,7 @@ class InstalledVersionsTest extends TestCase
|
|||
public function testGetRawData(): void
|
||||
{
|
||||
$dir = $this->root;
|
||||
$this->assertSame(require __DIR__.'/Repository/Fixtures/installed_relative.php', InstalledVersions::getRawData());
|
||||
self::assertSame(require __DIR__.'/Repository/Fixtures/installed_relative.php', InstalledVersions::getRawData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,7 +230,7 @@ class InstalledVersionsTest extends TestCase
|
|||
*/
|
||||
public function testGetReference(?string $expected, string $name): void
|
||||
{
|
||||
$this->assertSame($expected, InstalledVersions::getReference($name));
|
||||
self::assertSame($expected, InstalledVersions::getReference($name));
|
||||
}
|
||||
|
||||
public static function getReferenceProvider(): array
|
||||
|
@ -257,13 +257,13 @@ class InstalledVersionsTest extends TestCase
|
|||
'c/c',
|
||||
];
|
||||
|
||||
$this->assertSame($names, \Composer\InstalledVersions::getInstalledPackagesByType('library'));
|
||||
self::assertSame($names, \Composer\InstalledVersions::getInstalledPackagesByType('library'));
|
||||
}
|
||||
|
||||
public function testGetInstallPath(): void
|
||||
{
|
||||
$this->assertSame(realpath($this->root), realpath(\Composer\InstalledVersions::getInstallPath('__root__')));
|
||||
$this->assertSame('/foo/bar/vendor/c/c', \Composer\InstalledVersions::getInstallPath('c/c'));
|
||||
$this->assertNull(\Composer\InstalledVersions::getInstallPath('foo/impl'));
|
||||
self::assertSame(realpath($this->root), realpath(\Composer\InstalledVersions::getInstallPath('__root__')));
|
||||
self::assertSame('/foo/bar/vendor/c/c', \Composer\InstalledVersions::getInstallPath('c/c'));
|
||||
self::assertNull(\Composer\InstalledVersions::getInstallPath('foo/impl'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ class BinaryInstallerTest extends TestCase
|
|||
|
||||
$proc = new ProcessExecutor();
|
||||
$proc->execute($this->binDir.'/binary arg', $output);
|
||||
$this->assertEquals('', $proc->getErrorOutput());
|
||||
$this->assertEquals('success arg', $output);
|
||||
self::assertEquals('', $proc->getErrorOutput());
|
||||
self::assertEquals('success arg', $output);
|
||||
}
|
||||
|
||||
public static function executableBinaryProvider(): array
|
||||
|
|
|
@ -57,7 +57,7 @@ class InstallationManagerTest extends TestCase
|
|||
$manager = new InstallationManager($this->loop, $this->io);
|
||||
|
||||
$manager->addInstaller($installer);
|
||||
$this->assertSame($installer, $manager->getInstaller('vendor'));
|
||||
self::assertSame($installer, $manager->getInstaller('vendor'));
|
||||
|
||||
self::expectException('InvalidArgumentException');
|
||||
$manager->getInstaller('unregistered');
|
||||
|
@ -86,11 +86,11 @@ class InstallationManagerTest extends TestCase
|
|||
$manager = new InstallationManager($this->loop, $this->io);
|
||||
|
||||
$manager->addInstaller($installer);
|
||||
$this->assertSame($installer, $manager->getInstaller('vendor'));
|
||||
self::assertSame($installer, $manager->getInstaller('vendor'));
|
||||
$manager->addInstaller($installer2);
|
||||
$this->assertSame($installer2, $manager->getInstaller('vendor'));
|
||||
self::assertSame($installer2, $manager->getInstaller('vendor'));
|
||||
$manager->removeInstaller($installer2);
|
||||
$this->assertSame($installer, $manager->getInstaller('vendor'));
|
||||
self::assertSame($installer, $manager->getInstaller('vendor'));
|
||||
}
|
||||
|
||||
public function testExecute(): void
|
||||
|
|
|
@ -24,11 +24,9 @@ class InstallerEventTest extends TestCase
|
|||
$transaction = $this->getMockBuilder('Composer\DependencyResolver\LockTransaction')->disableOriginalConstructor()->getMock();
|
||||
$event = new InstallerEvent('EVENT_NAME', $composer, $io, true, true, $transaction);
|
||||
|
||||
$this->assertSame('EVENT_NAME', $event->getName());
|
||||
$this->assertInstanceOf('Composer\Composer', $event->getComposer());
|
||||
$this->assertInstanceOf('Composer\IO\IOInterface', $event->getIO());
|
||||
$this->assertTrue($event->isDevMode());
|
||||
$this->assertTrue($event->isExecutingOperations());
|
||||
$this->assertInstanceOf('Composer\DependencyResolver\Transaction', $event->getTransaction());
|
||||
self::assertSame('EVENT_NAME', $event->getName());
|
||||
self::assertTrue($event->isDevMode());
|
||||
self::assertTrue($event->isExecutingOperations());
|
||||
self::assertInstanceOf('Composer\DependencyResolver\Transaction', $event->getTransaction());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class LibraryInstallerTest extends TestCase
|
|||
$this->fs->removeDirectory($this->vendorDir);
|
||||
|
||||
new LibraryInstaller($this->io, $this->composer);
|
||||
$this->assertFileDoesNotExist($this->vendorDir);
|
||||
self::assertFileDoesNotExist($this->vendorDir);
|
||||
}
|
||||
|
||||
public function testInstallerCreationShouldNotCreateBinDirectory(): void
|
||||
|
@ -116,7 +116,7 @@ class LibraryInstallerTest extends TestCase
|
|||
$this->fs->removeDirectory($this->binDir);
|
||||
|
||||
new LibraryInstaller($this->io, $this->composer);
|
||||
$this->assertFileDoesNotExist($this->binDir);
|
||||
self::assertFileDoesNotExist($this->binDir);
|
||||
}
|
||||
|
||||
public function testIsInstalled(): void
|
||||
|
@ -125,18 +125,18 @@ class LibraryInstallerTest extends TestCase
|
|||
$package = self::getPackage('test/pkg', '1.0.0');
|
||||
|
||||
$repository = new InstalledArrayRepository();
|
||||
$this->assertFalse($library->isInstalled($repository, $package));
|
||||
self::assertFalse($library->isInstalled($repository, $package));
|
||||
|
||||
// package being in repo is not enough to be installed
|
||||
$repository->addPackage($package);
|
||||
$this->assertFalse($library->isInstalled($repository, $package));
|
||||
self::assertFalse($library->isInstalled($repository, $package));
|
||||
|
||||
// package being in repo and vendor/pkg/foo dir present means it is seen as installed
|
||||
self::ensureDirectoryExistsAndClear($this->vendorDir.'/'.$package->getPrettyName());
|
||||
$this->assertTrue($library->isInstalled($repository, $package));
|
||||
self::assertTrue($library->isInstalled($repository, $package));
|
||||
|
||||
$repository->removePackage($package);
|
||||
$this->assertFalse($library->isInstalled($repository, $package));
|
||||
self::assertFalse($library->isInstalled($repository, $package));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,8 +160,8 @@ class LibraryInstallerTest extends TestCase
|
|||
->with($package);
|
||||
|
||||
$library->install($this->repository, $package);
|
||||
$this->assertFileExists($this->vendorDir, 'Vendor dir should be created');
|
||||
$this->assertFileExists($this->binDir, 'Bin dir should be created');
|
||||
self::assertFileExists($this->vendorDir, 'Vendor dir should be created');
|
||||
self::assertFileExists($this->binDir, 'Bin dir should be created');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,8 +206,8 @@ class LibraryInstallerTest extends TestCase
|
|||
|
||||
$library = new LibraryInstaller($this->io, $this->composer, 'library', $filesystem);
|
||||
$library->update($this->repository, $initial, $target);
|
||||
$this->assertFileExists($this->vendorDir, 'Vendor dir should be created');
|
||||
$this->assertFileExists($this->binDir, 'Bin dir should be created');
|
||||
self::assertFileExists($this->vendorDir, 'Vendor dir should be created');
|
||||
self::assertFileExists($this->binDir, 'Bin dir should be created');
|
||||
|
||||
self::expectException('InvalidArgumentException');
|
||||
|
||||
|
@ -248,7 +248,7 @@ class LibraryInstallerTest extends TestCase
|
|||
$library = new LibraryInstaller($this->io, $this->composer);
|
||||
$package = self::getPackage('Vendor/Pkg', '1.0.0');
|
||||
|
||||
$this->assertEquals($this->vendorDir.'/'.$package->getPrettyName(), $library->getInstallPath($package));
|
||||
self::assertEquals($this->vendorDir.'/'.$package->getPrettyName(), $library->getInstallPath($package));
|
||||
}
|
||||
|
||||
public function testGetInstallPathWithTargetDir(): void
|
||||
|
@ -257,7 +257,7 @@ class LibraryInstallerTest extends TestCase
|
|||
$package = self::getPackage('Foo/Bar', '1.0.0');
|
||||
$package->setTargetDir('Some/Namespace');
|
||||
|
||||
$this->assertEquals($this->vendorDir.'/'.$package->getPrettyName().'/Some/Namespace', $library->getInstallPath($package));
|
||||
self::assertEquals($this->vendorDir.'/'.$package->getPrettyName().'/Some/Namespace', $library->getInstallPath($package));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,7 @@ class SuggestedPackagesReporterTest extends TestCase
|
|||
*/
|
||||
public function testGetPackagesEmptyByDefault(): void
|
||||
{
|
||||
$this->assertEmpty($this->suggestedPackagesReporter->getPackages());
|
||||
self::assertEmpty($this->suggestedPackagesReporter->getPackages());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class SuggestedPackagesReporterTest extends TestCase
|
|||
$suggestedPackage['target'],
|
||||
$suggestedPackage['reason']
|
||||
);
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[$suggestedPackage],
|
||||
$this->suggestedPackagesReporter->getPackages()
|
||||
);
|
||||
|
@ -99,7 +99,7 @@ class SuggestedPackagesReporterTest extends TestCase
|
|||
$suggestedPackageB['target'],
|
||||
$suggestedPackageB['reason']
|
||||
);
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[$suggestedPackageA, $suggestedPackageB],
|
||||
$this->suggestedPackagesReporter->getPackages()
|
||||
);
|
||||
|
@ -122,7 +122,7 @@ class SuggestedPackagesReporterTest extends TestCase
|
|||
->will($this->returnValue('package-pretty-name'));
|
||||
|
||||
$this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
|
||||
$this->assertSame([
|
||||
self::assertSame([
|
||||
[
|
||||
'source' => 'package-pretty-name',
|
||||
'target' => 'target-a',
|
||||
|
|
|
@ -138,20 +138,20 @@ class InstallerTest extends TestCase
|
|||
$result = $installer->run();
|
||||
|
||||
$output = str_replace("\r", '', $io->getOutput());
|
||||
$this->assertEquals(0, $result, $output);
|
||||
self::assertEquals(0, $result, $output);
|
||||
|
||||
$expectedInstalled = $options['install'] ?? [];
|
||||
$expectedUpdated = $options['update'] ?? [];
|
||||
$expectedUninstalled = $options['uninstall'] ?? [];
|
||||
|
||||
$installed = $installationManager->getInstalledPackages();
|
||||
$this->assertEquals($this->makePackagesComparable($expectedInstalled), $this->makePackagesComparable($installed));
|
||||
self::assertEquals($this->makePackagesComparable($expectedInstalled), $this->makePackagesComparable($installed));
|
||||
|
||||
$updated = $installationManager->getUpdatedPackages();
|
||||
$this->assertSame($expectedUpdated, $updated);
|
||||
self::assertSame($expectedUpdated, $updated);
|
||||
|
||||
$uninstalled = $installationManager->getUninstalledPackages();
|
||||
$this->assertSame($expectedUninstalled, $uninstalled);
|
||||
self::assertSame($expectedUninstalled, $uninstalled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,10 +441,10 @@ class InstallerTest extends TestCase
|
|||
}
|
||||
|
||||
$output = str_replace("\r", '', $io->getOutput());
|
||||
$this->assertEquals($expectResult, $result, $output . stream_get_contents($appOutput));
|
||||
self::assertEquals($expectResult, $result, $output . stream_get_contents($appOutput));
|
||||
if ($expectLock && isset($actualLock)) {
|
||||
unset($actualLock['hash'], $actualLock['content-hash'], $actualLock['_readme'], $actualLock['plugin-api-version']);
|
||||
$this->assertEquals($expectLock, $actualLock);
|
||||
self::assertEquals($expectLock, $actualLock);
|
||||
}
|
||||
|
||||
if ($expectInstalled !== null) {
|
||||
|
@ -461,18 +461,18 @@ class InstallerTest extends TestCase
|
|||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
$this->assertSame($expectInstalled, $actualInstalled);
|
||||
self::assertSame($expectInstalled, $actualInstalled);
|
||||
}
|
||||
|
||||
/** @var InstallationManagerMock $installationManager */
|
||||
$installationManager = $composer->getInstallationManager();
|
||||
$this->assertSame(rtrim($expect), implode("\n", $installationManager->getTrace()));
|
||||
self::assertSame(rtrim($expect), implode("\n", $installationManager->getTrace()));
|
||||
|
||||
if ($expectOutput) {
|
||||
$output = Preg::replace('{^ - .*?\.ini$}m', '__inilist__', $output);
|
||||
$output = Preg::replace('{(__inilist__\r?\n)+}', "__inilist__\n", $output);
|
||||
|
||||
$this->assertStringMatchesFormat(rtrim($expectOutput), rtrim($output));
|
||||
self::assertStringMatchesFormat(rtrim($expectOutput), rtrim($output));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,21 +33,21 @@ class ComposerSchemaTest extends TestCase
|
|||
];
|
||||
|
||||
$json = '{"name": "vendor/-pack__age", "description": "description"}';
|
||||
$this->assertEquals($expectedError, $this->check($json));
|
||||
self::assertEquals($expectedError, $this->check($json));
|
||||
$json = '{"name": "Vendor/Package", "description": "description"}';
|
||||
$this->assertEquals($expectedError, $this->check($json));
|
||||
self::assertEquals($expectedError, $this->check($json));
|
||||
}
|
||||
|
||||
public function testOptionalAbandonedProperty(): void
|
||||
{
|
||||
$json = '{"name": "vendor/package", "description": "description", "abandoned": true}';
|
||||
$this->assertTrue($this->check($json));
|
||||
self::assertTrue($this->check($json));
|
||||
}
|
||||
|
||||
public function testRequireTypes(): void
|
||||
{
|
||||
$json = '{"name": "vendor/package", "description": "description", "require": {"a": ["b"]} }';
|
||||
$this->assertEquals([
|
||||
self::assertEquals([
|
||||
['property' => 'require.a', 'message' => 'Array value found, but a string is required', 'constraint' => 'type'],
|
||||
], $this->check($json));
|
||||
}
|
||||
|
@ -64,31 +64,31 @@ class ComposerSchemaTest extends TestCase
|
|||
];
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "" }';
|
||||
$this->assertEquals($expectedError, $this->check($json), 'empty string');
|
||||
self::assertEquals($expectedError, $this->check($json), 'empty string');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dummy" }';
|
||||
$this->assertEquals($expectedError, $this->check($json), 'dummy');
|
||||
self::assertEquals($expectedError, $this->check($json), 'dummy');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "devz" }';
|
||||
$this->assertEquals($expectedError, $this->check($json), 'devz');
|
||||
self::assertEquals($expectedError, $this->check($json), 'devz');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dev" }';
|
||||
$this->assertTrue($this->check($json), 'dev');
|
||||
self::assertTrue($this->check($json), 'dev');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "alpha" }';
|
||||
$this->assertTrue($this->check($json), 'alpha');
|
||||
self::assertTrue($this->check($json), 'alpha');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "beta" }';
|
||||
$this->assertTrue($this->check($json), 'beta');
|
||||
self::assertTrue($this->check($json), 'beta');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "rc" }';
|
||||
$this->assertTrue($this->check($json), 'rc lowercase');
|
||||
self::assertTrue($this->check($json), 'rc lowercase');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "RC" }';
|
||||
$this->assertTrue($this->check($json), 'rc uppercase');
|
||||
self::assertTrue($this->check($json), 'rc uppercase');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "stable" }';
|
||||
$this->assertTrue($this->check($json), 'stable');
|
||||
self::assertTrue($this->check($json), 'stable');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,15 +110,15 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
$this->assertContains($expectedError, $e->getErrors());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertContains($expectedError, $e->getErrors());
|
||||
}
|
||||
try {
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
$this->fail('Expected exception to be thrown (lax)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
$this->assertContains($expectedError, $e->getErrors());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertContains($expectedError, $e->getErrors());
|
||||
}
|
||||
unlink($file);
|
||||
}
|
||||
|
@ -132,8 +132,8 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals(sprintf('"%s" does not match the expected JSON schema', $file), $e->getMessage());
|
||||
$this->assertEquals(['The property foo is not defined and the definition does not allow additional properties'], $e->getErrors());
|
||||
self::assertEquals(sprintf('"%s" does not match the expected JSON schema', $file), $e->getMessage());
|
||||
self::assertEquals(['The property foo is not defined and the definition does not allow additional properties'], $e->getErrors());
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
unlink($file);
|
||||
|
@ -151,10 +151,10 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
$errors = $e->getErrors();
|
||||
$this->assertContains('name : The property name is required', $errors);
|
||||
$this->assertContains('description : The property description is required', $errors);
|
||||
self::assertContains('name : The property name is required', $errors);
|
||||
self::assertContains('description : The property description is required', $errors);
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
||||
|
@ -163,8 +163,8 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
$this->assertEquals(['description : The property description is required'], $e->getErrors());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals(['description : The property description is required'], $e->getErrors());
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
||||
|
@ -173,8 +173,8 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
$this->assertEquals(['name : The property name is required'], $e->getErrors());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals(['name : The property name is required'], $e->getErrors());
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
||||
|
@ -183,10 +183,10 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
$errors = $e->getErrors();
|
||||
$this->assertContains('name : The property name is required', $errors);
|
||||
$this->assertContains('description : The property description is required', $errors);
|
||||
self::assertContains('name : The property name is required', $errors);
|
||||
self::assertContains('description : The property description is required', $errors);
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
||||
|
@ -195,10 +195,10 @@ class JsonFileTest extends TestCase
|
|||
$json->validateSchema();
|
||||
$this->fail('Expected exception to be thrown (strict)');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
$errors = $e->getErrors();
|
||||
$this->assertContains('name : The property name is required', $errors);
|
||||
$this->assertContains('description : The property description is required', $errors);
|
||||
self::assertContains('name : The property name is required', $errors);
|
||||
self::assertContains('description : The property description is required', $errors);
|
||||
}
|
||||
$json->validateSchema(JsonFile::LAX_SCHEMA);
|
||||
|
||||
|
@ -252,8 +252,8 @@ class JsonFileTest extends TestCase
|
|||
JsonFile::validateJsonSchema('COMPOSER_AUTH', $json, JsonFile::AUTH_SCHEMA);
|
||||
$this->fail('Expected exception to be thrown');
|
||||
} catch (JsonValidationException $e) {
|
||||
$this->assertEquals($expectedMessage, $e->getMessage());
|
||||
$this->assertSame([$expectedError], $e->getErrors());
|
||||
self::assertEquals($expectedMessage, $e->getMessage());
|
||||
self::assertSame([$expectedError], $e->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ class JsonFileTest extends TestCase
|
|||
$json = '{
|
||||
"name": "composer/composer"
|
||||
}';
|
||||
$this->assertJsonFormat($json, $data);
|
||||
self::assertJsonFormat($json, $data);
|
||||
}
|
||||
|
||||
public function testTrailingBackslash(): void
|
||||
|
@ -291,7 +291,7 @@ class JsonFileTest extends TestCase
|
|||
$json = '{
|
||||
"Metadata\\\\": "src/"
|
||||
}';
|
||||
$this->assertJsonFormat($json, $data);
|
||||
self::assertJsonFormat($json, $data);
|
||||
}
|
||||
|
||||
public function testFormatEmptyArray(): void
|
||||
|
@ -301,7 +301,7 @@ class JsonFileTest extends TestCase
|
|||
"test": [],
|
||||
"test2": {}
|
||||
}';
|
||||
$this->assertJsonFormat($json, $data);
|
||||
self::assertJsonFormat($json, $data);
|
||||
}
|
||||
|
||||
public function testEscape(): void
|
||||
|
@ -311,7 +311,7 @@ class JsonFileTest extends TestCase
|
|||
"Metadata\\\\\\"": "src/"
|
||||
}';
|
||||
|
||||
$this->assertJsonFormat($json, $data);
|
||||
self::assertJsonFormat($json, $data);
|
||||
}
|
||||
|
||||
public function testUnicode(): void
|
||||
|
@ -321,35 +321,35 @@ class JsonFileTest extends TestCase
|
|||
"Žluťoučký \" kůň": "úpěl ďábelské ódy za €"
|
||||
}';
|
||||
|
||||
$this->assertJsonFormat($json, $data);
|
||||
self::assertJsonFormat($json, $data);
|
||||
}
|
||||
|
||||
public function testOnlyUnicode(): void
|
||||
{
|
||||
$data = "\\/ƌ";
|
||||
|
||||
$this->assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE);
|
||||
self::assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function testEscapedSlashes(): void
|
||||
{
|
||||
$data = "\\/foo";
|
||||
|
||||
$this->assertJsonFormat('"\\\\\\/foo"', $data, 0);
|
||||
self::assertJsonFormat('"\\\\\\/foo"', $data, 0);
|
||||
}
|
||||
|
||||
public function testEscapedBackslashes(): void
|
||||
{
|
||||
$data = "a\\b";
|
||||
|
||||
$this->assertJsonFormat('"a\\\\b"', $data, 0);
|
||||
self::assertJsonFormat('"a\\\\b"', $data, 0);
|
||||
}
|
||||
|
||||
public function testEscapedUnicode(): void
|
||||
{
|
||||
$data = "ƌ";
|
||||
|
||||
$this->assertJsonFormat('"\\u018c"', $data, 0);
|
||||
self::assertJsonFormat('"\\u018c"', $data, 0);
|
||||
}
|
||||
|
||||
public function testDoubleEscapedUnicode(): void
|
||||
|
@ -361,7 +361,7 @@ class JsonFileTest extends TestCase
|
|||
|
||||
$decodedData = json_decode($doubleEncodedData, true);
|
||||
$doubleData = json_decode($decodedData['t'], true);
|
||||
$this->assertEquals($data, $doubleData);
|
||||
self::assertEquals($data, $doubleData);
|
||||
}
|
||||
|
||||
public function testPreserveIndentationAfterRead(): void
|
||||
|
@ -393,7 +393,7 @@ class JsonFileTest extends TestCase
|
|||
$result = JsonFile::parseJson($json);
|
||||
$this->fail(sprintf("Parsing should have failed but didn't.\nExpected:\n\"%s\"\nFor:\n\"%s\"\nGot:\n\"%s\"", $text, $json, var_export($result, true)));
|
||||
} catch (ParsingException $e) {
|
||||
$this->assertStringContainsString($text, $e->getMessage());
|
||||
self::assertStringContainsString($text, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,9 +406,9 @@ class JsonFileTest extends TestCase
|
|||
|
||||
$json = str_replace("\r", '', $json);
|
||||
if (null === $options) {
|
||||
$this->assertEquals($json, $file->encode($data));
|
||||
self::assertEquals($json, $file->encode($data));
|
||||
} else {
|
||||
$this->assertEquals($json, $file->encode($data, $options));
|
||||
self::assertEquals($json, $file->encode($data, $options));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class JsonFormatterTest extends TestCase
|
|||
$data = '"' . $backslash . $backslash . $backslash . 'u0119"';
|
||||
$expected = '"' . $backslash . $backslash . 'ę"';
|
||||
/** @phpstan-ignore staticMethod.dynamicCall, staticMethod.deprecatedClass */
|
||||
$this->assertEquals($expected, JsonFormatter::format($data, true, true));
|
||||
self::assertEquals($expected, JsonFormatter::format($data, true, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,6 +45,6 @@ class JsonFormatterTest extends TestCase
|
|||
|
||||
$escaped = '"\ud83d\ude00"';
|
||||
/** @phpstan-ignore staticMethod.dynamicCall, staticMethod.deprecatedClass */
|
||||
$this->assertEquals($escaped, JsonFormatter::format($escaped, true, true));
|
||||
self::assertEquals($escaped, JsonFormatter::format($escaped, true, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace Composer\Test\Json;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Json\JsonManipulator;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
|
@ -23,8 +24,8 @@ class JsonManipulatorTest extends TestCase
|
|||
public function testAddLink(string $json, string $type, string $package, string $constraint, string $expected): void
|
||||
{
|
||||
$manipulator = new JsonManipulator($json);
|
||||
$this->assertTrue($manipulator->addLink($type, $package, $constraint));
|
||||
$this->assertEquals($expected, $manipulator->getContents());
|
||||
self::assertTrue($manipulator->addLink($type, $package, $constraint));
|
||||
self::assertEquals($expected, $manipulator->getContents());
|
||||
}
|
||||
|
||||
public static function linkProvider(): array
|
||||
|
@ -1293,8 +1294,8 @@ class JsonManipulatorTest extends TestCase
|
|||
public function testAddLinkAndSortPackages(string $json, string $type, string $package, string $constraint, bool $sortPackages, string $expected): void
|
||||
{
|
||||
$manipulator = new JsonManipulator($json);
|
||||
$this->assertTrue($manipulator->addLink($type, $package, $constraint, $sortPackages));
|
||||
$this->assertEquals($expected, $manipulator->getContents());
|
||||
self::assertTrue($manipulator->addLink($type, $package, $constraint, $sortPackages));
|
||||
self::assertEquals($expected, $manipulator->getContents());
|
||||
}
|
||||
|
||||
public static function providerAddLinkAndSortPackages(): array
|
||||
|
@ -1374,9 +1375,9 @@ class JsonManipulatorTest extends TestCase
|
|||
{
|
||||
$manipulator = new JsonManipulator($json);
|
||||
|
||||
$this->assertEquals($expected, $manipulator->removeSubNode('repositories', $name));
|
||||
self::assertEquals($expected, $manipulator->removeSubNode('repositories', $name));
|
||||
if (null !== $expectedContent) {
|
||||
$this->assertEquals($expectedContent, $manipulator->getContents());
|
||||
self::assertEquals($expectedContent, $manipulator->getContents());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1696,9 +1697,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeSubNode('require', 'package/c'));
|
||||
$this->assertTrue($manipulator->removeSubNode('require-dev', 'package/d'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeSubNode('require', 'package/c'));
|
||||
self::assertTrue($manipulator->removeSubNode('require-dev', 'package/d'));
|
||||
self::assertEquals('{
|
||||
"repositories": [
|
||||
{
|
||||
"package": {
|
||||
|
@ -1727,8 +1728,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"test": {"0": "foo"}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeSubNode('test', '0'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeSubNode('test', '0'));
|
||||
self::assertEquals('{
|
||||
"test": {
|
||||
}
|
||||
}
|
||||
|
@ -1743,8 +1744,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeConfigSetting('preferred-install.foo/*'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeConfigSetting('preferred-install.foo/*'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"preferred-install": {
|
||||
}
|
||||
|
@ -1777,9 +1778,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addSubNode('require', 'package/c', '*'));
|
||||
$this->assertTrue($manipulator->addSubNode('require-dev', 'package/e', '*'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addSubNode('require', 'package/c', '*'));
|
||||
self::assertTrue($manipulator->addSubNode('require-dev', 'package/e', '*'));
|
||||
self::assertEquals('{
|
||||
"repositories": [
|
||||
{
|
||||
"package": {
|
||||
|
@ -1825,8 +1826,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addProperty('extra.foo-bar', true));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addProperty('extra.foo-bar', true));
|
||||
self::assertEquals('{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
|
@ -1867,8 +1868,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('preferred-install.my-organization/stable-package', 'dist'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('preferred-install.my-organization/stable-package', 'dist'));
|
||||
self::assertEquals('{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
|
@ -1911,8 +1912,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addProperty('suggest.new-package', 'new-description'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addProperty('suggest.new-package', 'new-description'));
|
||||
self::assertEquals('{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
|
@ -1939,8 +1940,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addRepository('bar', ['type' => 'composer']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addRepository('bar', ['type' => 'composer']));
|
||||
self::assertEquals('{
|
||||
"repositories": {
|
||||
"bar": {
|
||||
"type": "composer"
|
||||
|
@ -1956,8 +1957,8 @@ class JsonManipulatorTest extends TestCase
|
|||
\t\"a\": \"b\"
|
||||
}");
|
||||
|
||||
$this->assertTrue($manipulator->addRepository('bar2', ['type' => 'composer']));
|
||||
$this->assertEquals("{
|
||||
self::assertTrue($manipulator->addRepository('bar2', ['type' => 'composer']));
|
||||
self::assertEquals("{
|
||||
\t\"a\": \"b\",
|
||||
\t\"repositories\": {
|
||||
\t\t\"bar2\": {
|
||||
|
@ -1979,8 +1980,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addRepository('bar', ['type' => 'composer'], true));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addRepository('bar', ['type' => 'composer'], true));
|
||||
self::assertEquals('{
|
||||
"repositories": {
|
||||
"foo": {
|
||||
"type": "vcs",
|
||||
|
@ -2005,8 +2006,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addRepository('bar', ['type' => 'composer'], false));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addRepository('bar', ['type' => 'composer'], false));
|
||||
self::assertEquals('{
|
||||
"repositories": {
|
||||
"bar": {
|
||||
"type": "composer"
|
||||
|
@ -2031,8 +2032,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addRepository('baz', ['type' => 'composer']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addRepository('baz', ['type' => 'composer']));
|
||||
self::assertEquals('{
|
||||
"repositories": {
|
||||
"baz": {
|
||||
"type": "composer"
|
||||
|
@ -2049,9 +2050,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('test', 'a\b'));
|
||||
$this->assertTrue($manipulator->addConfigSetting('test2', "a\nb\fa"));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('test', 'a\b'));
|
||||
self::assertTrue($manipulator->addConfigSetting('test2', "a\nb\fa"));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"test": "a\\\\b",
|
||||
"test2": "a\nb\fa"
|
||||
|
@ -2065,8 +2066,8 @@ class JsonManipulatorTest extends TestCase
|
|||
$manipulator = new JsonManipulator('{
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('foo.bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('foo.bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"foo": {
|
||||
"bar": "baz"
|
||||
|
@ -2084,8 +2085,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"foo": "bar",
|
||||
"bar": "baz"
|
||||
|
@ -2103,8 +2104,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('foo', 'zomg'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('foo', 'zomg'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"foo": "zomg",
|
||||
"bar": "baz"
|
||||
|
@ -2121,8 +2122,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('foo', 50));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('foo', 50));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"foo": 50
|
||||
}
|
||||
|
@ -2141,8 +2142,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-protocols', ['https', 'http']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('github-protocols', ['https', 'http']));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"github.com": "foo"
|
||||
|
@ -2152,8 +2153,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth', ['github.com' => 'bar', 'alt.example.org' => 'baz']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth', ['github.com' => 'bar', 'alt.example.org' => 'baz']));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"github.com": "bar",
|
||||
|
@ -2172,8 +2173,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"bar": "baz"
|
||||
|
@ -2193,10 +2194,10 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth2.a.bar', 'baz2'));
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth3.b', 'c'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth2.a.bar', 'baz2'));
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth3.b', 'c'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"bar": "baz"
|
||||
|
@ -2222,8 +2223,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addConfigSetting('github-oauth.bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"github.com": "foo",
|
||||
|
@ -2242,8 +2243,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addSubNode('github-oauth', 'bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addSubNode('github-oauth', 'bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"github-oauth": {
|
||||
"github.com": "foo",
|
||||
"bar": "baz"
|
||||
|
@ -2263,8 +2264,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeConfigSetting('github-oauth.bar'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeConfigSetting('github-oauth.bar'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"github-oauth": {
|
||||
"github.com": "foo"
|
||||
|
@ -2286,8 +2287,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeConfigSetting('github-oauth.bar'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeConfigSetting('github-oauth.bar'));
|
||||
self::assertEquals('{
|
||||
"config": {
|
||||
"foo": "bar",
|
||||
"github-oauth": {
|
||||
|
@ -2304,8 +2305,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"foo": "bar"
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('bar', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('bar', 'baz'));
|
||||
self::assertEquals('{
|
||||
"foo": "bar",
|
||||
"bar": "baz"
|
||||
}
|
||||
|
@ -2318,8 +2319,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"foo": "bar"
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('bar', '$1baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('bar', '$1baz'));
|
||||
self::assertEquals('{
|
||||
"foo": "bar",
|
||||
"bar": "$1baz"
|
||||
}
|
||||
|
@ -2330,8 +2331,8 @@ class JsonManipulatorTest extends TestCase
|
|||
{
|
||||
$manipulator = new JsonManipulator('{}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('foo', '$1bar'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('foo', '$1bar'));
|
||||
self::assertEquals('{
|
||||
"foo": "$1bar"
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
|
@ -2343,8 +2344,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"foo": "bar"
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('foo', 'baz'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('foo', 'baz'));
|
||||
self::assertEquals('{
|
||||
"foo": "baz"
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
|
@ -2361,9 +2362,9 @@ class JsonManipulatorTest extends TestCase
|
|||
"baz": "bar"
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('foo', 'baz'));
|
||||
$this->assertTrue($manipulator->addMainKey('baz', 'quux'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('foo', 'baz'));
|
||||
self::assertTrue($manipulator->addMainKey('baz', 'quux'));
|
||||
self::assertEquals('{
|
||||
"a": {
|
||||
"foo": "bar",
|
||||
"baz": "qux"
|
||||
|
@ -2385,8 +2386,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('require-dev', ['foo' => 'qux']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('require-dev', ['foo' => 'qux']));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"php": "5.*"
|
||||
},
|
||||
|
@ -2403,8 +2404,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"foo": "bar"
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('foo', '$1bar'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('foo', '$1bar'));
|
||||
self::assertEquals('{
|
||||
"foo": "$1bar"
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
|
@ -2436,8 +2437,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKey('repositories'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKey('repositories'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*",
|
||||
"package/b": "*",
|
||||
|
@ -2450,8 +2451,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKey('foo'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKey('foo'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*",
|
||||
"package/b": "*",
|
||||
|
@ -2463,9 +2464,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKey('require'));
|
||||
$this->assertTrue($manipulator->removeMainKey('require-dev'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKey('require'));
|
||||
self::assertTrue($manipulator->removeMainKey('require-dev'));
|
||||
self::assertEquals('{
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
|
@ -2485,8 +2486,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKeyIfEmpty('repositories'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKeyIfEmpty('repositories'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*",
|
||||
"package/b": "*",
|
||||
|
@ -2498,10 +2499,10 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKeyIfEmpty('foo'));
|
||||
$this->assertTrue($manipulator->removeMainKeyIfEmpty('require'));
|
||||
$this->assertTrue($manipulator->removeMainKeyIfEmpty('require-dev'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKeyIfEmpty('foo'));
|
||||
self::assertTrue($manipulator->removeMainKeyIfEmpty('require'));
|
||||
self::assertTrue($manipulator->removeMainKeyIfEmpty('require-dev'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*",
|
||||
"package/b": "*",
|
||||
|
@ -2521,11 +2522,11 @@ class JsonManipulatorTest extends TestCase
|
|||
|
||||
$manipulator->removeMainKey('bar');
|
||||
|
||||
$expected = json_encode([
|
||||
$expected = JsonFile::encode([
|
||||
'foo' => 9000,
|
||||
]);
|
||||
|
||||
$this->assertJsonStringEqualsJsonString($expected, $manipulator->getContents());
|
||||
self::assertJsonStringEqualsJsonString($expected, $manipulator->getContents());
|
||||
}
|
||||
|
||||
public function testIndentDetection(): void
|
||||
|
@ -2537,8 +2538,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addMainKey('require-dev', ['foo' => 'qux']));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('require-dev', ['foo' => 'qux']));
|
||||
self::assertEquals('{
|
||||
|
||||
"require": {
|
||||
"php": "5.*"
|
||||
|
@ -2558,9 +2559,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}
|
||||
');
|
||||
$this->assertTrue($manipulator->addMainKey('homepage', 'http...'));
|
||||
$this->assertTrue($manipulator->addMainKey('license', 'mit'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addMainKey('homepage', 'http...'));
|
||||
self::assertTrue($manipulator->addMainKey('license', 'mit'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*"
|
||||
},
|
||||
|
@ -2569,9 +2570,9 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
$this->assertTrue($manipulator->removeMainKey('homepage'));
|
||||
$this->assertTrue($manipulator->removeMainKey('license'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->removeMainKey('homepage'));
|
||||
self::assertTrue($manipulator->removeMainKey('license'));
|
||||
self::assertEquals('{
|
||||
"require": {
|
||||
"package/a": "*"
|
||||
}
|
||||
|
@ -2588,8 +2589,8 @@ class JsonManipulatorTest extends TestCase
|
|||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addLink('require', 'foo/baz', '^1.0'));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addLink('require', 'foo/baz', '^1.0'));
|
||||
self::assertEquals('{
|
||||
"description": "Some U\u00F1icode",
|
||||
"require": {
|
||||
"foo/bar": "^1.0",
|
||||
|
@ -3251,8 +3252,8 @@ class JsonManipulatorTest extends TestCase
|
|||
"prefer-stable": true
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addSubNode('config', 'platform-check', false));
|
||||
$this->assertEquals('{
|
||||
self::assertTrue($manipulator->addSubNode('config', 'platform-check', false));
|
||||
self::assertEquals('{
|
||||
"name": "leoloso/pop",
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
|
|
|
@ -25,14 +25,14 @@ class JsonValidationExceptionTest extends TestCase
|
|||
public function testGetErrors(string $message, array $errors, string $expectedMessage, array $expectedErrors): void
|
||||
{
|
||||
$object = new JsonValidationException($message, $errors);
|
||||
$this->assertSame($expectedMessage, $object->getMessage());
|
||||
$this->assertSame($expectedErrors, $object->getErrors());
|
||||
self::assertSame($expectedMessage, $object->getMessage());
|
||||
self::assertSame($expectedErrors, $object->getErrors());
|
||||
}
|
||||
|
||||
public function testGetErrorsWhenNoErrorsProvided(): void
|
||||
{
|
||||
$object = new JsonValidationException('test message');
|
||||
$this->assertEquals([], $object->getErrors());
|
||||
self::assertEquals([], $object->getErrors());
|
||||
}
|
||||
|
||||
public static function errorProvider(): array
|
||||
|
|
|
@ -116,7 +116,7 @@ class ArchivableFilesFinderTest extends TestCase
|
|||
|
||||
$this->finder = new ArchivableFilesFinder($this->sources, $excludes);
|
||||
|
||||
$this->assertArchivableFiles([
|
||||
self::assertArchivableFiles([
|
||||
'/!important!.txt',
|
||||
'/!important_too!.txt',
|
||||
'/#weirdfile',
|
||||
|
@ -191,7 +191,7 @@ class ArchivableFilesFinderTest extends TestCase
|
|||
|
||||
$this->finder = new ArchivableFilesFinder($this->sources, []);
|
||||
|
||||
$this->assertArchivableFiles($this->getArchivedFiles(
|
||||
self::assertArchivableFiles($this->getArchivedFiles(
|
||||
'git init && '.
|
||||
'git config user.email "you@example.com" && '.
|
||||
'git config user.name "Your Name" && '.
|
||||
|
@ -212,7 +212,7 @@ class ArchivableFilesFinderTest extends TestCase
|
|||
|
||||
$this->finder = new ArchivableFilesFinder($this->sources, $excludes, true);
|
||||
|
||||
$this->assertArchivableFiles([
|
||||
self::assertArchivableFiles([
|
||||
'/!important!.txt',
|
||||
'/!important_too!.txt',
|
||||
'/#weirdfile',
|
||||
|
@ -306,6 +306,6 @@ class ArchivableFilesFinderTest extends TestCase
|
|||
{
|
||||
$actualFiles = $this->getArchivableFiles();
|
||||
|
||||
$this->assertEquals($expectedFiles, $actualFiles);
|
||||
self::assertEquals($expectedFiles, $actualFiles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,10 +69,10 @@ class ArchiveManagerTest extends ArchiverTestCase
|
|||
$this->manager->archive($package, 'tar', $this->targetDir);
|
||||
|
||||
$target = $this->getTargetName($package, 'tar');
|
||||
$this->assertFileExists($target);
|
||||
self::assertFileExists($target);
|
||||
|
||||
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
|
||||
$this->assertFileDoesNotExist($tmppath);
|
||||
self::assertFileDoesNotExist($tmppath);
|
||||
|
||||
unlink($target);
|
||||
}
|
||||
|
@ -91,10 +91,10 @@ class ArchiveManagerTest extends ArchiverTestCase
|
|||
|
||||
$target = $this->targetDir . '/' . $fileName . '.tar';
|
||||
|
||||
$this->assertFileExists($target);
|
||||
self::assertFileExists($target);
|
||||
|
||||
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
|
||||
$this->assertFileDoesNotExist($tmppath);
|
||||
self::assertFileDoesNotExist($tmppath);
|
||||
|
||||
unlink($target);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class GitExcludeFilterTest extends TestCase
|
|||
{
|
||||
$filter = new GitExcludeFilter('/');
|
||||
|
||||
$this->assertEquals($expected, $filter->parseGitAttributesLine($ignore));
|
||||
self::assertEquals($expected, $filter->parseGitAttributesLine($ignore));
|
||||
}
|
||||
|
||||
public static function providePatterns(): array
|
||||
|
|
|
@ -27,7 +27,7 @@ class PharArchiverTest extends ArchiverTestCase
|
|||
// Test archive
|
||||
$archiver = new PharArchiver();
|
||||
$archiver->archive($package->getSourceUrl(), $target, 'tar', ['foo/bar', 'baz', '!/foo/bar/baz']);
|
||||
$this->assertFileExists($target);
|
||||
self::assertFileExists($target);
|
||||
|
||||
$this->filesystem->removeDirectory(dirname($target));
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class PharArchiverTest extends ArchiverTestCase
|
|||
// Test archive
|
||||
$archiver = new PharArchiver();
|
||||
$archiver->archive($package->getSourceUrl(), $target, 'zip');
|
||||
$this->assertFileExists($target);
|
||||
self::assertFileExists($target);
|
||||
|
||||
$this->filesystem->removeDirectory(dirname($target));
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class BasePackageTest extends TestCase
|
|||
$package->expects($this->once())->method('getPrettyVersion')->will($this->returnValue('PrettyVersion'));
|
||||
$package->expects($this->any())->method('getSourceReference')->will($this->returnValue($sourceReference));
|
||||
|
||||
$this->assertSame($expected, $package->getFullPrettyVersion($truncate));
|
||||
self::assertSame($expected, $package->getFullPrettyVersion($truncate));
|
||||
}
|
||||
|
||||
public static function provideFormattedVersions(): array
|
||||
|
@ -93,7 +93,7 @@ class BasePackageTest extends TestCase
|
|||
{
|
||||
$regexp = BasePackage::packageNamesToRegexp($packageNames, $wrap);
|
||||
|
||||
$this->assertSame($expectedRegexp, $regexp);
|
||||
self::assertSame($expectedRegexp, $regexp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ class CompletePackageTest extends TestCase
|
|||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals(strtolower($name), $package->getName());
|
||||
self::assertEquals(strtolower($name), $package->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,8 +53,8 @@ class CompletePackageTest extends TestCase
|
|||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals($version, $package->getPrettyVersion());
|
||||
$this->assertEquals($normVersion, $package->getVersion());
|
||||
self::assertEquals($version, $package->getPrettyVersion());
|
||||
self::assertEquals($normVersion, $package->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,34 +65,34 @@ class CompletePackageTest extends TestCase
|
|||
$versionParser = new VersionParser();
|
||||
$normVersion = $versionParser->normalize($version);
|
||||
$package = new Package($name, $normVersion, $version);
|
||||
$this->assertEquals(strtolower($name).'-'.$normVersion, (string) $package);
|
||||
self::assertEquals(strtolower($name).'-'.$normVersion, (string) $package);
|
||||
}
|
||||
|
||||
public function testGetTargetDir(): void
|
||||
{
|
||||
$package = new Package('a', '1.0.0.0', '1.0');
|
||||
|
||||
$this->assertNull($package->getTargetDir());
|
||||
self::assertNull($package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('./../foo/');
|
||||
$this->assertEquals('foo/', $package->getTargetDir());
|
||||
self::assertEquals('foo/', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('foo/../../../bar/');
|
||||
$this->assertEquals('foo/bar/', $package->getTargetDir());
|
||||
self::assertEquals('foo/bar/', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('../..');
|
||||
$this->assertEquals('', $package->getTargetDir());
|
||||
self::assertEquals('', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('..');
|
||||
$this->assertEquals('', $package->getTargetDir());
|
||||
self::assertEquals('', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('/..');
|
||||
$this->assertEquals('', $package->getTargetDir());
|
||||
self::assertEquals('', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('/foo/..');
|
||||
$this->assertEquals('foo/', $package->getTargetDir());
|
||||
self::assertEquals('foo/', $package->getTargetDir());
|
||||
|
||||
$package->setTargetDir('/foo/..//bar');
|
||||
$this->assertEquals('foo/bar', $package->getTargetDir());
|
||||
self::assertEquals('foo/bar', $package->getTargetDir());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ArrayDumperTest extends TestCase
|
|||
public function testRequiredInformation(): void
|
||||
{
|
||||
$config = $this->dumper->dump(self::getPackage());
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
[
|
||||
'name' => 'dummy/pkg',
|
||||
'version' => '1.0.0',
|
||||
|
@ -49,7 +49,7 @@ class ArrayDumperTest extends TestCase
|
|||
$package->setMinimumStability('dev');
|
||||
|
||||
$config = $this->dumper->dump($package);
|
||||
$this->assertSame('dev', $config['minimum-stability']);
|
||||
self::assertSame('dev', $config['minimum-stability']);
|
||||
}
|
||||
|
||||
public function testDumpAbandoned(): void
|
||||
|
@ -58,7 +58,7 @@ class ArrayDumperTest extends TestCase
|
|||
$package->setAbandoned(true);
|
||||
$config = $this->dumper->dump($package);
|
||||
|
||||
$this->assertTrue($config['abandoned']);
|
||||
self::assertTrue($config['abandoned']);
|
||||
}
|
||||
|
||||
public function testDumpAbandonedReplacement(): void
|
||||
|
@ -67,7 +67,7 @@ class ArrayDumperTest extends TestCase
|
|||
$package->setAbandoned('foo/bar');
|
||||
$config = $this->dumper->dump($package);
|
||||
|
||||
$this->assertSame('foo/bar', $config['abandoned']);
|
||||
self::assertSame('foo/bar', $config['abandoned']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,12 +81,12 @@ class ArrayDumperTest extends TestCase
|
|||
{
|
||||
$package = self::getRootPackage();
|
||||
|
||||
// @phpstan-ignore method.dynamicName, ternary.shortNotAllowed
|
||||
$package->{'set'.ucfirst($method ?: $key)}($value);
|
||||
// @phpstan-ignore method.dynamicName
|
||||
$package->{'set'.ucfirst($method ?? $key)}($value);
|
||||
|
||||
$config = $this->dumper->dump($package);
|
||||
|
||||
$this->assertSame($expectedValue ?: $value, $config[$key]);
|
||||
self::assertSame($expectedValue ?: $value, $config[$key]);
|
||||
}
|
||||
|
||||
public static function provideKeys(): array
|
||||
|
|
|
@ -42,7 +42,7 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
$replaces = $package->getReplaces();
|
||||
$this->assertEquals('== 1.2.3.4', (string) $replaces['foo']->getConstraint());
|
||||
self::assertEquals('== 1.2.3.4', (string) $replaces['foo']->getConstraint());
|
||||
}
|
||||
|
||||
public function testTypeDefault(): void
|
||||
|
@ -53,7 +53,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertEquals('library', $package->getType());
|
||||
self::assertEquals('library', $package->getType());
|
||||
|
||||
$config = [
|
||||
'name' => 'A',
|
||||
|
@ -62,7 +62,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertEquals('foo', $package->getType());
|
||||
self::assertEquals('foo', $package->getType());
|
||||
}
|
||||
|
||||
public function testNormalizedVersionOptimization(): void
|
||||
|
@ -73,7 +73,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertEquals('1.2.3.0', $package->getVersion());
|
||||
self::assertEquals('1.2.3.0', $package->getVersion());
|
||||
|
||||
$config = [
|
||||
'name' => 'A',
|
||||
|
@ -82,7 +82,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertEquals('1.2.3.4', $package->getVersion());
|
||||
self::assertEquals('1.2.3.4', $package->getVersion());
|
||||
}
|
||||
|
||||
public static function parseDumpProvider(): array
|
||||
|
@ -161,7 +161,7 @@ class ArrayLoaderTest extends TestCase
|
|||
$package = $this->loader->load($config);
|
||||
$dumper = new ArrayDumper;
|
||||
$expectedConfig = $this->fixConfigWhenLoadConfigIsFalse($config);
|
||||
$this->assertEquals($expectedConfig, $dumper->dump($package));
|
||||
self::assertEquals($expectedConfig, $dumper->dump($package));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +175,7 @@ class ArrayLoaderTest extends TestCase
|
|||
$package = $loader->load($config);
|
||||
$dumper = new ArrayDumper;
|
||||
$expectedConfig = $config;
|
||||
$this->assertEquals($expectedConfig, $dumper->dump($package));
|
||||
self::assertEquals($expectedConfig, $dumper->dump($package));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,7 +189,7 @@ class ArrayLoaderTest extends TestCase
|
|||
$package = $loader->load($config);
|
||||
$dumper = new ArrayDumper;
|
||||
$expectedConfig = $this->fixConfigWhenLoadConfigIsFalse($config);
|
||||
$this->assertEquals($expectedConfig, $dumper->dump($package));
|
||||
self::assertEquals($expectedConfig, $dumper->dump($package));
|
||||
}
|
||||
|
||||
public function testPackageWithBranchAlias(): void
|
||||
|
@ -202,8 +202,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
$this->assertEquals('1.0.x-dev', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
self::assertEquals('1.0.x-dev', $package->getPrettyVersion());
|
||||
|
||||
$config = [
|
||||
'name' => 'A',
|
||||
|
@ -213,8 +213,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
$this->assertEquals('1.0.x-dev', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
self::assertEquals('1.0.x-dev', $package->getPrettyVersion());
|
||||
|
||||
$config = [
|
||||
'name' => 'B',
|
||||
|
@ -224,8 +224,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
$this->assertEquals('4.0.x-dev', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
self::assertEquals('4.0.x-dev', $package->getPrettyVersion());
|
||||
|
||||
$config = [
|
||||
'name' => 'B',
|
||||
|
@ -235,8 +235,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
$this->assertEquals('4.0.x-dev', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
self::assertEquals('4.0.x-dev', $package->getPrettyVersion());
|
||||
|
||||
$config = [
|
||||
'name' => 'C',
|
||||
|
@ -246,8 +246,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
$this->assertEquals('4.x-dev', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
self::assertEquals('4.x-dev', $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testPackageAliasingWithoutBranchAlias(): void
|
||||
|
@ -261,8 +261,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
$this->assertEquals(VersionParser::DEFAULT_BRANCH_ALIAS, $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\AliasPackage', $package);
|
||||
self::assertEquals(VersionParser::DEFAULT_BRANCH_ALIAS, $package->getPrettyVersion());
|
||||
|
||||
// non-default branch gets no alias even if non-numeric
|
||||
$config = [
|
||||
|
@ -273,8 +273,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
$this->assertEquals('dev-main', $package->getPrettyVersion());
|
||||
self::assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
self::assertEquals('dev-main', $package->getPrettyVersion());
|
||||
|
||||
// default branch gets no alias if already numeric
|
||||
$config = [
|
||||
|
@ -285,8 +285,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
$this->assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
|
||||
self::assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
self::assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
|
||||
|
||||
// default branch gets no alias if already numeric, with v prefix
|
||||
$config = [
|
||||
|
@ -297,8 +297,8 @@ class ArrayLoaderTest extends TestCase
|
|||
|
||||
$package = $this->loader->load($config);
|
||||
|
||||
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
$this->assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
|
||||
self::assertInstanceOf('Composer\Package\CompletePackage', $package);
|
||||
self::assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
|
||||
}
|
||||
|
||||
public function testAbandoned(): void
|
||||
|
@ -310,8 +310,8 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertTrue($package->isAbandoned());
|
||||
$this->assertEquals('foo/bar', $package->getReplacementPackage());
|
||||
self::assertTrue($package->isAbandoned());
|
||||
self::assertEquals('foo/bar', $package->getReplacementPackage());
|
||||
}
|
||||
|
||||
public function testNotAbandoned(): void
|
||||
|
@ -322,7 +322,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertFalse($package->isAbandoned());
|
||||
self::assertFalse($package->isAbandoned());
|
||||
}
|
||||
|
||||
public static function providePluginApiVersions(): array
|
||||
|
@ -353,23 +353,23 @@ class ArrayLoaderTest extends TestCase
|
|||
{
|
||||
$links = $this->loader->parseLinks('Plugin', '9.9.9', Link::TYPE_REQUIRE, ['composer-plugin-api' => $apiVersion]);
|
||||
|
||||
$this->assertArrayHasKey('composer-plugin-api', $links);
|
||||
$this->assertSame($apiVersion, $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
self::assertArrayHasKey('composer-plugin-api', $links);
|
||||
self::assertSame($apiVersion, $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testPluginApiVersionDoesSupportSelfVersion(): void
|
||||
{
|
||||
$links = $this->loader->parseLinks('Plugin', '6.6.6', Link::TYPE_REQUIRE, ['composer-plugin-api' => 'self.version']);
|
||||
|
||||
$this->assertArrayHasKey('composer-plugin-api', $links);
|
||||
$this->assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
self::assertArrayHasKey('composer-plugin-api', $links);
|
||||
self::assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testParseLinksIntegerTarget(): void
|
||||
{
|
||||
$links = $this->loader->parseLinks('Plugin', '9.9.9', Link::TYPE_REQUIRE, ['1' => 'dev-main']);
|
||||
|
||||
$this->assertArrayHasKey('1', $links);
|
||||
self::assertArrayHasKey('1', $links);
|
||||
}
|
||||
|
||||
public function testNoneStringVersion(): void
|
||||
|
@ -380,7 +380,7 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertSame('1', $package->getPrettyVersion());
|
||||
self::assertSame('1', $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testNoneStringSourceDistReference(): void
|
||||
|
@ -401,8 +401,8 @@ class ArrayLoaderTest extends TestCase
|
|||
];
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertSame('2019', $package->getSourceReference());
|
||||
$this->assertSame('2019', $package->getDistReference());
|
||||
self::assertSame('2019', $package->getSourceReference());
|
||||
self::assertSame('2019', $package->getDistReference());
|
||||
}
|
||||
|
||||
public function testBranchAliasIntegerIndex(): void
|
||||
|
@ -421,7 +421,7 @@ class ArrayLoaderTest extends TestCase
|
|||
],
|
||||
];
|
||||
|
||||
$this->assertNull($this->loader->getBranchAlias($config));
|
||||
self::assertNull($this->loader->getBranchAlias($config));
|
||||
}
|
||||
|
||||
public function testPackageLinksRequire(): void
|
||||
|
@ -435,8 +435,8 @@ class ArrayLoaderTest extends TestCase
|
|||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertArrayHasKey('foo/bar', $package->getRequires());
|
||||
$this->assertSame('1.0', $package->getRequires()['foo/bar']->getConstraint()->getPrettyString());
|
||||
self::assertArrayHasKey('foo/bar', $package->getRequires());
|
||||
self::assertSame('1.0', $package->getRequires()['foo/bar']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testPackageLinksRequireInvalid(): void
|
||||
|
@ -452,7 +452,7 @@ class ArrayLoaderTest extends TestCase
|
|||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertCount(0, $package->getRequires());
|
||||
self::assertCount(0, $package->getRequires());
|
||||
}
|
||||
|
||||
public function testPackageLinksReplace(): void
|
||||
|
@ -466,8 +466,8 @@ class ArrayLoaderTest extends TestCase
|
|||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertArrayHasKey('coyote/package', $package->getReplaces());
|
||||
$this->assertSame('dev-1', $package->getReplaces()['coyote/package']->getConstraint()->getPrettyString());
|
||||
self::assertArrayHasKey('coyote/package', $package->getReplaces());
|
||||
self::assertSame('dev-1', $package->getReplaces()['coyote/package']->getConstraint()->getPrettyString());
|
||||
}
|
||||
|
||||
public function testPackageLinksReplaceInvalid(): void
|
||||
|
@ -479,7 +479,7 @@ class ArrayLoaderTest extends TestCase
|
|||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertCount(0, $package->getReplaces());
|
||||
self::assertCount(0, $package->getReplaces());
|
||||
}
|
||||
|
||||
public function testSupportStringValue(): void
|
||||
|
@ -491,6 +491,6 @@ class ArrayLoaderTest extends TestCase
|
|||
);
|
||||
|
||||
$package = $this->loader->load($config);
|
||||
$this->assertSame([], $package->getSupport());
|
||||
self::assertSame([], $package->getSupport());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ class RootPackageLoaderTest extends TestCase
|
|||
'minimum-stability' => 'alpha',
|
||||
]);
|
||||
|
||||
$this->assertEquals('alpha', $package->getMinimumStability());
|
||||
$this->assertEquals([
|
||||
self::assertEquals('alpha', $package->getMinimumStability());
|
||||
self::assertEquals([
|
||||
'bar/baz' => BasePackage::STABILITY_DEV,
|
||||
'qux/quux' => BasePackage::STABILITY_RC,
|
||||
'zux/complex' => BasePackage::STABILITY_DEV,
|
||||
|
@ -88,8 +88,8 @@ class RootPackageLoaderTest extends TestCase
|
|||
|
||||
$package = $loader->load([]);
|
||||
|
||||
$this->assertEquals("1.0.0.0", $package->getVersion());
|
||||
$this->assertEquals(RootPackage::DEFAULT_PRETTY_VERSION, $package->getPrettyVersion());
|
||||
self::assertEquals("1.0.0.0", $package->getVersion());
|
||||
self::assertEquals(RootPackage::DEFAULT_PRETTY_VERSION, $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testPrettyVersionForRootPackageInVersionBranch(): void
|
||||
|
@ -110,7 +110,7 @@ class RootPackageLoaderTest extends TestCase
|
|||
$loader = new RootPackageLoader($manager, $config, null, $versionGuesser);
|
||||
$package = $loader->load([]);
|
||||
|
||||
$this->assertEquals('3.0-dev', $package->getPrettyVersion());
|
||||
self::assertEquals('3.0-dev', $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testFeatureBranchPrettyVersion(): void
|
||||
|
@ -138,7 +138,7 @@ class RootPackageLoaderTest extends TestCase
|
|||
$loader = new RootPackageLoader($manager, $config, null, new VersionGuesser($config, $process, new VersionParser()));
|
||||
$package = $loader->load(['require' => ['foo/bar' => 'self.version']]);
|
||||
|
||||
$this->assertEquals("dev-master", $package->getPrettyVersion());
|
||||
self::assertEquals("dev-master", $package->getPrettyVersion());
|
||||
}
|
||||
|
||||
public function testNonFeatureBranchPrettyVersion(): void
|
||||
|
@ -165,6 +165,6 @@ class RootPackageLoaderTest extends TestCase
|
|||
$loader = new RootPackageLoader($manager, $config, null, new VersionGuesser($config, $process, new VersionParser()));
|
||||
$package = $loader->load(['require' => ['foo/bar' => 'self.version'], "non-feature-branches" => ["latest-.*"]]);
|
||||
|
||||
$this->assertEquals("dev-latest-production", $package->getPrettyVersion());
|
||||
self::assertEquals("dev-latest-production", $package->getPrettyVersion());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
|||
$errors = $e->getErrors();
|
||||
sort($expectedErrors);
|
||||
sort($errors);
|
||||
$this->assertEquals($expectedErrors, $errors);
|
||||
self::assertEquals($expectedErrors, $errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
|||
$warnings = $loader->getWarnings();
|
||||
sort($expectedWarnings);
|
||||
sort($warnings);
|
||||
$this->assertEquals($expectedWarnings, $warnings);
|
||||
self::assertEquals($expectedWarnings, $warnings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -255,7 +255,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
|||
public function testLoadSkipsWarningDataWhenIgnoringErrors(array $config, array $expectedWarnings, bool $mustCheck = true): void
|
||||
{
|
||||
if (!$mustCheck) {
|
||||
$this->assertTrue(true);
|
||||
self::assertTrue(true); // @phpstan-ignore staticMethod.alreadyNarrowedType
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['packages' => []]));
|
||||
|
||||
$this->assertTrue($locker->isLocked());
|
||||
self::assertTrue($locker->isLocked());
|
||||
}
|
||||
|
||||
public function testGetNotLockedPackages(): void
|
||||
|
@ -81,8 +81,8 @@ class LockerTest extends TestCase
|
|||
]));
|
||||
|
||||
$repo = $locker->getLockedRepository();
|
||||
$this->assertNotNull($repo->findPackage('pkg1', '1.0.0-beta'));
|
||||
$this->assertNotNull($repo->findPackage('pkg2', '0.1.10'));
|
||||
self::assertNotNull($repo->findPackage('pkg1', '1.0.0-beta'));
|
||||
self::assertNotNull($repo->findPackage('pkg2', '0.1.10'));
|
||||
}
|
||||
|
||||
public function testSetLockData(): void
|
||||
|
@ -156,7 +156,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['hash' => md5($jsonContent)]));
|
||||
|
||||
$this->assertTrue($locker->isFresh());
|
||||
self::assertTrue($locker->isFresh());
|
||||
}
|
||||
|
||||
public function testIsFreshFalse(): void
|
||||
|
@ -171,7 +171,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['hash' => $this->getJsonContent(['name' => 'test2'])]));
|
||||
|
||||
$this->assertFalse($locker->isFresh());
|
||||
self::assertFalse($locker->isFresh());
|
||||
}
|
||||
|
||||
public function testIsFreshWithContentHash(): void
|
||||
|
@ -187,7 +187,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['hash' => md5($jsonContent . ' '), 'content-hash' => md5($jsonContent)]));
|
||||
|
||||
$this->assertTrue($locker->isFresh());
|
||||
self::assertTrue($locker->isFresh());
|
||||
}
|
||||
|
||||
public function testIsFreshWithContentHashAndNoHash(): void
|
||||
|
@ -203,7 +203,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['content-hash' => md5($jsonContent)]));
|
||||
|
||||
$this->assertTrue($locker->isFresh());
|
||||
self::assertTrue($locker->isFresh());
|
||||
}
|
||||
|
||||
public function testIsFreshFalseWithContentHash(): void
|
||||
|
@ -220,7 +220,7 @@ class LockerTest extends TestCase
|
|||
->method('read')
|
||||
->will($this->returnValue(['hash' => $differentHash, 'content-hash' => $differentHash]));
|
||||
|
||||
$this->assertFalse($locker->isFresh());
|
||||
self::assertFalse($locker->isFresh());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,9 +31,9 @@ class RootAliasPackageTest extends TestCase
|
|||
->with($this->equalTo($links));
|
||||
|
||||
$alias = new RootAliasPackage($root, '1.0', '1.0.0.0');
|
||||
$this->assertEmpty($alias->getRequires());
|
||||
self::assertEmpty($alias->getRequires());
|
||||
$alias->setRequires($links);
|
||||
$this->assertNotEmpty($alias->getRequires());
|
||||
self::assertNotEmpty($alias->getRequires());
|
||||
}
|
||||
|
||||
public function testUpdateDevRequires(): void
|
||||
|
@ -46,9 +46,9 @@ class RootAliasPackageTest extends TestCase
|
|||
->with($this->equalTo($links));
|
||||
|
||||
$alias = new RootAliasPackage($root, '1.0', '1.0.0.0');
|
||||
$this->assertEmpty($alias->getDevRequires());
|
||||
self::assertEmpty($alias->getDevRequires());
|
||||
$alias->setDevRequires($links);
|
||||
$this->assertNotEmpty($alias->getDevRequires());
|
||||
self::assertNotEmpty($alias->getDevRequires());
|
||||
}
|
||||
|
||||
public function testUpdateConflicts(): void
|
||||
|
@ -61,9 +61,9 @@ class RootAliasPackageTest extends TestCase
|
|||
->with($this->equalTo($links));
|
||||
|
||||
$alias = new RootAliasPackage($root, '1.0', '1.0.0.0');
|
||||
$this->assertEmpty($alias->getConflicts());
|
||||
self::assertEmpty($alias->getConflicts());
|
||||
$alias->setConflicts($links);
|
||||
$this->assertNotEmpty($alias->getConflicts());
|
||||
self::assertNotEmpty($alias->getConflicts());
|
||||
}
|
||||
|
||||
public function testUpdateProvides(): void
|
||||
|
@ -76,9 +76,9 @@ class RootAliasPackageTest extends TestCase
|
|||
->with($this->equalTo($links));
|
||||
|
||||
$alias = new RootAliasPackage($root, '1.0', '1.0.0.0');
|
||||
$this->assertEmpty($alias->getProvides());
|
||||
self::assertEmpty($alias->getProvides());
|
||||
$alias->setProvides($links);
|
||||
$this->assertNotEmpty($alias->getProvides());
|
||||
self::assertNotEmpty($alias->getProvides());
|
||||
}
|
||||
|
||||
public function testUpdateReplaces(): void
|
||||
|
@ -91,9 +91,9 @@ class RootAliasPackageTest extends TestCase
|
|||
->with($this->equalTo($links));
|
||||
|
||||
$alias = new RootAliasPackage($root, '1.0', '1.0.0.0');
|
||||
$this->assertEmpty($alias->getReplaces());
|
||||
self::assertEmpty($alias->getReplaces());
|
||||
$alias->setReplaces($links);
|
||||
$this->assertNotEmpty($alias->getReplaces());
|
||||
self::assertNotEmpty($alias->getReplaces());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ class VersionBumperTest extends TestCase
|
|||
$newConstraint = $versionBumper->bumpRequirement($versionParser->parseConstraints($requirement), $package);
|
||||
|
||||
// assert that the recommended version is what we expect
|
||||
$this->assertSame($expectedRequirement, $newConstraint);
|
||||
self::assertSame($expectedRequirement, $newConstraint);
|
||||
}
|
||||
|
||||
public static function provideBumpRequirementTests(): Generator
|
||||
|
|
|
@ -50,9 +50,9 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-".$branch, $versionArray['version']);
|
||||
$this->assertEquals("dev-".$branch, $versionArray['pretty_version']);
|
||||
$this->assertEmpty($versionArray['commit']);
|
||||
self::assertEquals("dev-".$branch, $versionArray['version']);
|
||||
self::assertEquals("dev-".$branch, $versionArray['pretty_version']);
|
||||
self::assertEmpty($versionArray['commit']);
|
||||
}
|
||||
|
||||
public function testGuessVersionReturnsData(): void
|
||||
|
@ -74,11 +74,11 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-master", $versionArray['version']);
|
||||
$this->assertEquals("dev-master", $versionArray['pretty_version']);
|
||||
$this->assertArrayNotHasKey('feature_version', $versionArray);
|
||||
$this->assertArrayNotHasKey('feature_pretty_version', $versionArray);
|
||||
$this->assertEquals($commitHash, $versionArray['commit']);
|
||||
self::assertEquals("dev-master", $versionArray['version']);
|
||||
self::assertEquals("dev-master", $versionArray['pretty_version']);
|
||||
self::assertArrayNotHasKey('feature_version', $versionArray);
|
||||
self::assertArrayNotHasKey('feature_pretty_version', $versionArray);
|
||||
self::assertEquals($commitHash, $versionArray['commit']);
|
||||
}
|
||||
|
||||
public function testGuessVersionDoesNotSeeCustomDefaultBranchAsNonFeatureBranch(): void
|
||||
|
@ -101,8 +101,8 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion(['version' => 'self.version'], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-current", $versionArray['version']);
|
||||
$this->assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
self::assertEquals("dev-current", $versionArray['version']);
|
||||
self::assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
}
|
||||
|
||||
public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNaming(): void
|
||||
|
@ -128,11 +128,11 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion(['version' => 'self.version', 'non-feature-branches' => ['arbitrary']], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-arbitrary", $versionArray['version']);
|
||||
$this->assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
self::assertEquals("dev-arbitrary", $versionArray['version']);
|
||||
self::assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
self::assertArrayHasKey('feature_version', $versionArray);
|
||||
$this->assertEquals("dev-feature", $versionArray['feature_version']);
|
||||
$this->assertEquals("dev-feature", $versionArray['feature_pretty_version']);
|
||||
self::assertEquals("dev-feature", $versionArray['feature_version']);
|
||||
self::assertEquals("dev-feature", $versionArray['feature_pretty_version']);
|
||||
}
|
||||
|
||||
public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingRegex(): void
|
||||
|
@ -158,11 +158,11 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion(['version' => 'self.version', 'non-feature-branches' => ['latest-.*']], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-latest-testing", $versionArray['version']);
|
||||
$this->assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
self::assertEquals("dev-latest-testing", $versionArray['version']);
|
||||
self::assertEquals($anotherCommitHash, $versionArray['commit']);
|
||||
self::assertArrayHasKey('feature_version', $versionArray);
|
||||
$this->assertEquals("dev-feature", $versionArray['feature_version']);
|
||||
$this->assertEquals("dev-feature", $versionArray['feature_pretty_version']);
|
||||
self::assertEquals("dev-feature", $versionArray['feature_version']);
|
||||
self::assertEquals("dev-feature", $versionArray['feature_pretty_version']);
|
||||
}
|
||||
|
||||
public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingWhenOnNonFeatureBranch(): void
|
||||
|
@ -184,10 +184,10 @@ class VersionGuesserTest extends TestCase
|
|||
$versionArray = $guesser->guessVersion(['version' => 'self.version', 'non-feature-branches' => ['latest-.*']], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionArray);
|
||||
$this->assertEquals("dev-latest-testing", $versionArray['version']);
|
||||
$this->assertEquals($commitHash, $versionArray['commit']);
|
||||
$this->assertArrayNotHasKey('feature_version', $versionArray);
|
||||
$this->assertArrayNotHasKey('feature_pretty_version', $versionArray);
|
||||
self::assertEquals("dev-latest-testing", $versionArray['version']);
|
||||
self::assertEquals($commitHash, $versionArray['commit']);
|
||||
self::assertArrayNotHasKey('feature_version', $versionArray);
|
||||
self::assertArrayNotHasKey('feature_pretty_version', $versionArray);
|
||||
}
|
||||
|
||||
public function testDetachedHeadBecomesDevHash(): void
|
||||
|
@ -209,7 +209,7 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("dev-$commitHash", $versionData['version']);
|
||||
self::assertEquals("dev-$commitHash", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testDetachedFetchHeadBecomesDevHashGit2(): void
|
||||
|
@ -231,7 +231,7 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("dev-$commitHash", $versionData['version']);
|
||||
self::assertEquals("dev-$commitHash", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testDetachedCommitHeadBecomesDevHashGit2(): void
|
||||
|
@ -253,7 +253,7 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("dev-$commitHash", $versionData['version']);
|
||||
self::assertEquals("dev-$commitHash", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testTagBecomesVersion(): void
|
||||
|
@ -276,7 +276,7 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("2.0.5.0-alpha2", $versionData['version']);
|
||||
self::assertEquals("2.0.5.0-alpha2", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testTagBecomesPrettyVersion(): void
|
||||
|
@ -299,8 +299,8 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals('1.0.0.0', $versionData['version']);
|
||||
$this->assertEquals('1.0.0', $versionData['pretty_version']);
|
||||
self::assertEquals('1.0.0.0', $versionData['version']);
|
||||
self::assertEquals('1.0.0', $versionData['pretty_version']);
|
||||
}
|
||||
|
||||
public function testInvalidTagBecomesVersion(): void
|
||||
|
@ -319,7 +319,7 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("dev-foo", $versionData['version']);
|
||||
self::assertEquals("dev-foo", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testNumericBranchesShowNicely(): void
|
||||
|
@ -338,8 +338,8 @@ class VersionGuesserTest extends TestCase
|
|||
$versionData = $guesser->guessVersion([], 'dummy/path');
|
||||
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("1.5.x-dev", $versionData['pretty_version']);
|
||||
$this->assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
|
||||
self::assertEquals("1.5.x-dev", $versionData['pretty_version']);
|
||||
self::assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
|
||||
}
|
||||
|
||||
public function testRemoteBranchesAreSelected(): void
|
||||
|
@ -362,7 +362,7 @@ class VersionGuesserTest extends TestCase
|
|||
$guesser = new VersionGuesser($config, $process, new VersionParser());
|
||||
$versionData = $guesser->guessVersion(['version' => 'self.version'], 'dummy/path');
|
||||
self::assertIsArray($versionData);
|
||||
$this->assertEquals("1.5.x-dev", $versionData['pretty_version']);
|
||||
$this->assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
|
||||
self::assertEquals("1.5.x-dev", $versionData['pretty_version']);
|
||||
self::assertEquals("1.5.9999999.9999999-dev", $versionData['version']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class VersionParserTest extends TestCase
|
|||
{
|
||||
$versionParser = new VersionParser();
|
||||
|
||||
$this->assertSame($result, $versionParser->parseNameVersionPairs($pairs));
|
||||
self::assertSame($result, $versionParser->parseNameVersionPairs($pairs));
|
||||
}
|
||||
|
||||
public static function provideParseNameVersionPairsData(): array
|
||||
|
@ -46,7 +46,7 @@ class VersionParserTest extends TestCase
|
|||
*/
|
||||
public function testIsUpgrade(string $from, string $to, bool $expected): void
|
||||
{
|
||||
$this->assertSame($expected, VersionParser::isUpgrade($from, $to));
|
||||
self::assertSame($expected, VersionParser::isUpgrade($from, $to));
|
||||
}
|
||||
|
||||
public static function provideIsUpgradeTests(): array
|
||||
|
|
|
@ -48,7 +48,7 @@ class VersionSelectorTest extends TestCase
|
|||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
|
||||
// 1.2.2 should be returned because it's the latest of the returned versions
|
||||
$this->assertSame($package2, $best, 'Latest version should be 1.2.2');
|
||||
self::assertSame($package2, $best, 'Latest version should be 1.2.2');
|
||||
}
|
||||
|
||||
public function testLatestVersionIsReturnedThatMatchesPhpRequirements(): void
|
||||
|
@ -77,12 +77,12 @@ class VersionSelectorTest extends TestCase
|
|||
|
||||
$io = new BufferIO();
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', null, 0, $io);
|
||||
$this->assertSame((string) $package1, (string) $best, 'Latest version supporting php 5.5 should be returned (1.0.0)');
|
||||
self::assertSame((string) $package1, (string) $best, 'Latest version supporting php 5.5 should be returned (1.0.0)');
|
||||
self::assertSame("<warning>Cannot use foo/bar's latest version 2.1.0 as it requires php >=5.6 which is not satisfied by your platform.".PHP_EOL, $io->getOutput());
|
||||
|
||||
$io = new BufferIO('', StreamOutput::VERBOSITY_VERBOSE);
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', null, 0, $io);
|
||||
$this->assertSame((string) $package1, (string) $best, 'Latest version supporting php 5.5 should be returned (1.0.0)');
|
||||
self::assertSame((string) $package1, (string) $best, 'Latest version supporting php 5.5 should be returned (1.0.0)');
|
||||
self::assertSame(
|
||||
"<warning>Cannot use foo/bar's latest version 2.1.0 as it requires php >=5.6 which is not satisfied by your platform.".PHP_EOL
|
||||
."<warning>Cannot use foo/bar 2.0.0 as it requires php >=5.6 which is not satisfied by your platform.".PHP_EOL,
|
||||
|
@ -90,7 +90,7 @@ class VersionSelectorTest extends TestCase
|
|||
);
|
||||
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', PlatformRequirementFilterFactory::ignoreAll());
|
||||
$this->assertSame((string) $package3, (string) $best, 'Latest version should be returned when ignoring platform reqs (2.1.0)');
|
||||
self::assertSame((string) $package3, (string) $best, 'Latest version should be returned when ignoring platform reqs (2.1.0)');
|
||||
}
|
||||
|
||||
public function testLatestVersionIsReturnedThatMatchesExtRequirements(): void
|
||||
|
@ -114,9 +114,9 @@ class VersionSelectorTest extends TestCase
|
|||
->will($this->returnValue($packages));
|
||||
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
$this->assertSame($package1, $best, 'Latest version supporting ext-zip 5.3.0 should be returned (1.0.0)');
|
||||
self::assertSame($package1, $best, 'Latest version supporting ext-zip 5.3.0 should be returned (1.0.0)');
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', PlatformRequirementFilterFactory::ignoreAll());
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)');
|
||||
}
|
||||
|
||||
public function testLatestVersionIsReturnedThatMatchesPlatformExt(): void
|
||||
|
@ -139,9 +139,9 @@ class VersionSelectorTest extends TestCase
|
|||
->will($this->returnValue($packages));
|
||||
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
$this->assertSame($package1, $best, 'Latest version not requiring ext-barfoo should be returned (1.0.0)');
|
||||
self::assertSame($package1, $best, 'Latest version not requiring ext-barfoo should be returned (1.0.0)');
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', PlatformRequirementFilterFactory::ignoreAll());
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)');
|
||||
}
|
||||
|
||||
public function testLatestVersionIsReturnedThatMatchesComposerRequirements(): void
|
||||
|
@ -165,9 +165,9 @@ class VersionSelectorTest extends TestCase
|
|||
->will($this->returnValue($packages));
|
||||
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
$this->assertSame($package1, $best, 'Latest version supporting composer 1 should be returned (1.0.0)');
|
||||
self::assertSame($package1, $best, 'Latest version supporting composer 1 should be returned (1.0.0)');
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable', PlatformRequirementFilterFactory::ignoreAll());
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (1.1.0)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (1.1.0)');
|
||||
}
|
||||
|
||||
public function testMostStableVersionIsReturned(): void
|
||||
|
@ -187,7 +187,7 @@ class VersionSelectorTest extends TestCase
|
|||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
|
||||
$this->assertSame($package1, $best, 'Latest most stable version should be returned (1.0.0)');
|
||||
self::assertSame($package1, $best, 'Latest most stable version should be returned (1.0.0)');
|
||||
}
|
||||
|
||||
public function testMostStableVersionIsReturnedRegardlessOfOrder(): void
|
||||
|
@ -209,10 +209,10 @@ class VersionSelectorTest extends TestCase
|
|||
|
||||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
$this->assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
|
||||
self::assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
|
||||
|
||||
$best = $versionSelector->findBestCandidate($packageName);
|
||||
$this->assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
|
||||
self::assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
|
||||
}
|
||||
|
||||
public function testHighestVersionIsReturned(): void
|
||||
|
@ -232,7 +232,7 @@ class VersionSelectorTest extends TestCase
|
|||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'dev');
|
||||
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
}
|
||||
|
||||
public function testHighestVersionMatchingStabilityIsReturned(): void
|
||||
|
@ -253,7 +253,7 @@ class VersionSelectorTest extends TestCase
|
|||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'beta');
|
||||
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
}
|
||||
|
||||
public function testMostStableUnstableVersionIsReturned(): void
|
||||
|
@ -273,7 +273,7 @@ class VersionSelectorTest extends TestCase
|
|||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'stable');
|
||||
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
|
||||
}
|
||||
|
||||
public function testDefaultBranchAliasIsNeverReturned(): void
|
||||
|
@ -294,7 +294,7 @@ class VersionSelectorTest extends TestCase
|
|||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate($packageName, null, 'dev');
|
||||
|
||||
$this->assertSame($package2, $best, 'Latest version should be returned (dev-main)');
|
||||
self::assertSame($package2, $best, 'Latest version should be returned (dev-main)');
|
||||
}
|
||||
|
||||
public function testFalseReturnedOnNoPackages(): void
|
||||
|
@ -306,7 +306,7 @@ class VersionSelectorTest extends TestCase
|
|||
|
||||
$versionSelector = new VersionSelector($repositorySet);
|
||||
$best = $versionSelector->findBestCandidate('foobaz');
|
||||
$this->assertFalse($best, 'No versions are available returns false');
|
||||
self::assertFalse($best, 'No versions are available returns false');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +327,7 @@ class VersionSelectorTest extends TestCase
|
|||
$recommended = $versionSelector->findRecommendedRequireVersion($package);
|
||||
|
||||
// assert that the recommended version is what we expect
|
||||
$this->assertSame($expectedVersion, $recommended);
|
||||
self::assertSame($expectedVersion, $recommended);
|
||||
}
|
||||
|
||||
public static function provideRecommendedRequireVersionPackages(): array
|
||||
|
|
|
@ -160,8 +160,8 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->install($this->repository, $this->packages[0]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals(
|
||||
self::assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals(
|
||||
'activate v1'.PHP_EOL,
|
||||
$this->io->getOutput()
|
||||
);
|
||||
|
@ -182,11 +182,11 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->install($this->repository, $this->packages[0]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertEquals(
|
||||
self::assertEquals(
|
||||
'activate v1'.PHP_EOL,
|
||||
$this->io->getOutput()
|
||||
);
|
||||
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
self::assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore property.notFound
|
||||
}
|
||||
|
||||
public function testInstallMultiplePlugins(): void
|
||||
|
@ -201,11 +201,11 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->install($this->repository, $this->packages[3]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertEquals('plugin1', $plugins[0]->name); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('installer-v4', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('plugin2', $plugins[1]->name); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('installer-v4', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('activate v4-plugin1'.PHP_EOL.'activate v4-plugin2'.PHP_EOL, $this->io->getOutput());
|
||||
self::assertEquals('plugin1', $plugins[0]->name); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('installer-v4', $plugins[0]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('plugin2', $plugins[1]->name); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('installer-v4', $plugins[1]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('activate v4-plugin1'.PHP_EOL.'activate v4-plugin2'.PHP_EOL, $this->io->getOutput());
|
||||
}
|
||||
|
||||
public function testUpgradeWithNewClassName(): void
|
||||
|
@ -224,9 +224,9 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->update($this->repository, $this->packages[0], $this->packages[1]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertCount(1, $plugins);
|
||||
$this->assertEquals('installer-v2', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'activate v2'.PHP_EOL, $this->io->getOutput());
|
||||
self::assertCount(1, $plugins);
|
||||
self::assertEquals('installer-v2', $plugins[1]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'activate v2'.PHP_EOL, $this->io->getOutput());
|
||||
}
|
||||
|
||||
public function testUninstall(): void
|
||||
|
@ -245,8 +245,8 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->uninstall($this->repository, $this->packages[0]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertCount(0, $plugins);
|
||||
$this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'uninstall v1'.PHP_EOL, $this->io->getOutput());
|
||||
self::assertCount(0, $plugins);
|
||||
self::assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'uninstall v1'.PHP_EOL, $this->io->getOutput());
|
||||
}
|
||||
|
||||
public function testUpgradeWithSameClassName(): void
|
||||
|
@ -265,8 +265,8 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->update($this->repository, $this->packages[1], $this->packages[2]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertEquals('installer-v3', $plugins[1]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('activate v2'.PHP_EOL.'deactivate v2'.PHP_EOL.'activate v3'.PHP_EOL, $this->io->getOutput());
|
||||
self::assertEquals('installer-v3', $plugins[1]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('activate v2'.PHP_EOL.'deactivate v2'.PHP_EOL.'activate v3'.PHP_EOL, $this->io->getOutput());
|
||||
}
|
||||
|
||||
public function testRegisterPluginOnlyOneTime(): void
|
||||
|
@ -282,9 +282,9 @@ class PluginInstallerTest extends TestCase
|
|||
$installer->install($this->repository, clone $this->packages[0]);
|
||||
|
||||
$plugins = $this->pm->getPlugins();
|
||||
$this->assertCount(1, $plugins);
|
||||
$this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore staticMethod.dynamicCall, property.notFound
|
||||
$this->assertEquals('activate v1'.PHP_EOL, $this->io->getOutput());
|
||||
self::assertCount(1, $plugins);
|
||||
self::assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore property.notFound
|
||||
self::assertEquals('activate v1'.PHP_EOL, $this->io->getOutput());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,16 +325,16 @@ class PluginInstallerTest extends TestCase
|
|||
$starVersionPlugin = [$this->packages[4]];
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.0.0', $starVersionPlugin);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.9.9', $starVersionPlugin);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('2.0.0-dev', $starVersionPlugin);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('100.0.0-stable', $starVersionPlugin);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
}
|
||||
|
||||
public function testPluginConstraintWorksOnlyWithCertainAPIVersion(): void
|
||||
|
@ -342,16 +342,16 @@ class PluginInstallerTest extends TestCase
|
|||
$pluginWithApiConstraint = [$this->packages[5]];
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.0.0', $pluginWithApiConstraint);
|
||||
$this->assertCount(0, $this->pm->getPlugins());
|
||||
self::assertCount(0, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.1.9', $pluginWithApiConstraint);
|
||||
$this->assertCount(0, $this->pm->getPlugins());
|
||||
self::assertCount(0, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.2.0', $pluginWithApiConstraint);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.9.9', $pluginWithApiConstraint);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
}
|
||||
|
||||
public function testPluginRangeConstraintsWorkOnlyWithCertainAPIVersion(): void
|
||||
|
@ -359,13 +359,13 @@ class PluginInstallerTest extends TestCase
|
|||
$pluginWithApiConstraint = [$this->packages[6]];
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('1.0.0', $pluginWithApiConstraint);
|
||||
$this->assertCount(0, $this->pm->getPlugins());
|
||||
self::assertCount(0, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('3.0.0', $pluginWithApiConstraint);
|
||||
$this->assertCount(1, $this->pm->getPlugins());
|
||||
self::assertCount(1, $this->pm->getPlugins());
|
||||
|
||||
$this->setPluginApiVersionWithPlugins('5.5.0', $pluginWithApiConstraint);
|
||||
$this->assertCount(0, $this->pm->getPlugins());
|
||||
self::assertCount(0, $this->pm->getPlugins());
|
||||
}
|
||||
|
||||
public function testCommandProviderCapability(): void
|
||||
|
@ -379,19 +379,19 @@ class PluginInstallerTest extends TestCase
|
|||
|
||||
/** @var \Composer\Plugin\Capability\CommandProvider[] $caps */
|
||||
$caps = $this->pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', ['composer' => $this->composer, 'io' => $this->io]);
|
||||
$this->assertCount(1, $caps);
|
||||
$this->assertInstanceOf('Composer\Plugin\Capability\CommandProvider', $caps[0]);
|
||||
self::assertCount(1, $caps);
|
||||
self::assertInstanceOf('Composer\Plugin\Capability\CommandProvider', $caps[0]);
|
||||
|
||||
$commands = $caps[0]->getCommands();
|
||||
$this->assertCount(1, $commands);
|
||||
$this->assertInstanceOf('Composer\Command\BaseCommand', $commands[0]);
|
||||
self::assertCount(1, $commands);
|
||||
self::assertInstanceOf('Composer\Command\BaseCommand', $commands[0]);
|
||||
}
|
||||
|
||||
public function testIncapablePluginIsCorrectlyDetected(): void
|
||||
{
|
||||
$plugin = $this->getMockBuilder('Composer\Plugin\PluginInterface')
|
||||
->getMock();
|
||||
$this->assertNull($this->pm->getPluginCapability($plugin, 'Fake\Ability'));
|
||||
self::assertNull($this->pm->getPluginCapability($plugin, 'Fake\Ability'));
|
||||
}
|
||||
|
||||
public function testCapabilityImplementsComposerPluginApiClassAndIsConstructedWithArgs(): void
|
||||
|
@ -411,9 +411,9 @@ class PluginInstallerTest extends TestCase
|
|||
/** @var \Composer\Test\Plugin\Mock\Capability $capability */
|
||||
$capability = $this->pm->getPluginCapability($plugin, $capabilityApi, ['a' => 1, 'b' => 2]);
|
||||
|
||||
$this->assertInstanceOf($capabilityApi, $capability);
|
||||
$this->assertInstanceOf($capabilityImplementation, $capability);
|
||||
$this->assertSame(['a' => 1, 'b' => 2, 'plugin' => $plugin], $capability->args);
|
||||
self::assertInstanceOf($capabilityApi, $capability);
|
||||
self::assertInstanceOf($capabilityImplementation, $capability);
|
||||
self::assertSame(['a' => 1, 'b' => 2, 'plugin' => $plugin], $capability->args);
|
||||
}
|
||||
|
||||
/** @return mixed[] */
|
||||
|
@ -467,7 +467,7 @@ class PluginInstallerTest extends TestCase
|
|||
return [];
|
||||
}));
|
||||
|
||||
$this->assertNull($this->pm->getPluginCapability($plugin, $capabilityApi));
|
||||
self::assertNull($this->pm->getPluginCapability($plugin, $capabilityApi));
|
||||
}
|
||||
|
||||
/** @return mixed[] */
|
||||
|
|
|
@ -63,7 +63,7 @@ class StrictConfirmationQuestionTest extends TestCase
|
|||
[$input, $dialog] = $this->createInput($question."\n");
|
||||
|
||||
$question = new StrictConfirmationQuestion('Do you like French fries?', $default);
|
||||
$this->assertEquals($expected, $dialog->ask($input, $this->createOutputInterface(), $question), 'confirmation question should '.($expected ? 'pass' : 'cancel'));
|
||||
self::assertEquals($expected, $dialog->ask($input, $this->createOutputInterface(), $question), 'confirmation question should '.($expected ? 'pass' : 'cancel'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,10 +88,10 @@ class StrictConfirmationQuestionTest extends TestCase
|
|||
$question = new StrictConfirmationQuestion('Do you like French fries?', false, '/^ja$/i', '/^nein$/i');
|
||||
|
||||
[$input, $dialog] = $this->createInput("ja\n");
|
||||
$this->assertTrue($dialog->ask($input, $this->createOutputInterface(), $question));
|
||||
self::assertTrue($dialog->ask($input, $this->createOutputInterface(), $question));
|
||||
|
||||
[$input, $dialog] = $this->createInput("nein\n");
|
||||
$this->assertFalse($dialog->ask($input, $this->createOutputInterface(), $question));
|
||||
self::assertFalse($dialog->ask($input, $this->createOutputInterface(), $question));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,7 @@ class StrictConfirmationQuestionTest extends TestCase
|
|||
protected function getInputStream(string $input)
|
||||
{
|
||||
$stream = fopen('php://memory', 'r+', false);
|
||||
$this->assertNotFalse($stream);
|
||||
self::assertNotFalse($stream);
|
||||
|
||||
fwrite($stream, $input);
|
||||
rewind($stream);
|
||||
|
|
|
@ -23,7 +23,7 @@ class ArrayRepositoryTest extends TestCase
|
|||
$repo = new ArrayRepository;
|
||||
$repo->addPackage(self::getPackage('foo', '1'));
|
||||
|
||||
$this->assertCount(1, $repo);
|
||||
self::assertCount(1, $repo);
|
||||
}
|
||||
|
||||
public function testRemovePackage(): void
|
||||
|
@ -34,12 +34,12 @@ class ArrayRepositoryTest extends TestCase
|
|||
$repo->addPackage(self::getPackage('foo', '1'));
|
||||
$repo->addPackage($package);
|
||||
|
||||
$this->assertCount(2, $repo);
|
||||
self::assertCount(2, $repo);
|
||||
|
||||
$repo->removePackage(self::getPackage('foo', '1'));
|
||||
|
||||
$this->assertCount(1, $repo);
|
||||
$this->assertEquals([$package], $repo->getPackages());
|
||||
self::assertCount(1, $repo);
|
||||
self::assertEquals([$package], $repo->getPackages());
|
||||
}
|
||||
|
||||
public function testHasPackage(): void
|
||||
|
@ -48,8 +48,8 @@ class ArrayRepositoryTest extends TestCase
|
|||
$repo->addPackage(self::getPackage('foo', '1'));
|
||||
$repo->addPackage(self::getPackage('bar', '2'));
|
||||
|
||||
$this->assertTrue($repo->hasPackage(self::getPackage('foo', '1')));
|
||||
$this->assertFalse($repo->hasPackage(self::getPackage('bar', '1')));
|
||||
self::assertTrue($repo->hasPackage(self::getPackage('foo', '1')));
|
||||
self::assertFalse($repo->hasPackage(self::getPackage('bar', '1')));
|
||||
}
|
||||
|
||||
public function testFindPackages(): void
|
||||
|
@ -60,12 +60,12 @@ class ArrayRepositoryTest extends TestCase
|
|||
$repo->addPackage(self::getPackage('bar', '3'));
|
||||
|
||||
$foo = $repo->findPackages('foo');
|
||||
$this->assertCount(1, $foo);
|
||||
$this->assertEquals('foo', $foo[0]->getName());
|
||||
self::assertCount(1, $foo);
|
||||
self::assertEquals('foo', $foo[0]->getName());
|
||||
|
||||
$bar = $repo->findPackages('bar');
|
||||
$this->assertCount(2, $bar);
|
||||
$this->assertEquals('bar', $bar[0]->getName());
|
||||
self::assertCount(2, $bar);
|
||||
self::assertEquals('bar', $bar[0]->getName());
|
||||
}
|
||||
|
||||
public function testAutomaticallyAddAliasedPackageButNotRemove(): void
|
||||
|
@ -77,13 +77,13 @@ class ArrayRepositoryTest extends TestCase
|
|||
|
||||
$repo->addPackage($alias);
|
||||
|
||||
$this->assertCount(2, $repo);
|
||||
$this->assertTrue($repo->hasPackage(self::getPackage('foo', '1')));
|
||||
$this->assertTrue($repo->hasPackage(self::getPackage('foo', '2')));
|
||||
self::assertCount(2, $repo);
|
||||
self::assertTrue($repo->hasPackage(self::getPackage('foo', '1')));
|
||||
self::assertTrue($repo->hasPackage(self::getPackage('foo', '2')));
|
||||
|
||||
$repo->removePackage($alias);
|
||||
|
||||
$this->assertCount(1, $repo);
|
||||
self::assertCount(1, $repo);
|
||||
}
|
||||
|
||||
public function testSearch(): void
|
||||
|
@ -93,17 +93,17 @@ class ArrayRepositoryTest extends TestCase
|
|||
$repo->addPackage(self::getPackage('foo', '1'));
|
||||
$repo->addPackage(self::getPackage('bar', '1'));
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[['name' => 'foo', 'description' => null]],
|
||||
$repo->search('foo', RepositoryInterface::SEARCH_FULLTEXT)
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[['name' => 'bar', 'description' => null]],
|
||||
$repo->search('bar')
|
||||
);
|
||||
|
||||
$this->assertEmpty(
|
||||
self::assertEmpty(
|
||||
$repo->search('foobar')
|
||||
);
|
||||
}
|
||||
|
@ -119,14 +119,14 @@ class ArrayRepositoryTest extends TestCase
|
|||
$package->setType('composer-plugin');
|
||||
$repo->addPackage($package);
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[['name' => 'foo', 'description' => null]],
|
||||
$repo->search('foo', RepositoryInterface::SEARCH_FULLTEXT, 'library')
|
||||
);
|
||||
|
||||
$this->assertEmpty($repo->search('bar', RepositoryInterface::SEARCH_FULLTEXT, 'package'));
|
||||
self::assertEmpty($repo->search('bar', RepositoryInterface::SEARCH_FULLTEXT, 'package'));
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[['name' => 'foobar', 'description' => null]],
|
||||
$repo->search('foo', 0, 'composer-plugin')
|
||||
);
|
||||
|
@ -143,7 +143,7 @@ class ArrayRepositoryTest extends TestCase
|
|||
$package2->setAbandoned('bar');
|
||||
$repo->addPackage($package2);
|
||||
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
[
|
||||
['name' => 'foo1', 'description' => null, 'abandoned' => true],
|
||||
['name' => 'foo2', 'description' => null, 'abandoned' => 'bar'],
|
||||
|
|
|
@ -51,14 +51,14 @@ class ArtifactRepositoryTest extends TestCase
|
|||
sort($expectedPackages);
|
||||
sort($foundPackages);
|
||||
|
||||
$this->assertSame($expectedPackages, $foundPackages);
|
||||
self::assertSame($expectedPackages, $foundPackages);
|
||||
|
||||
$tarPackage = array_filter($repo->getPackages(), static function (BasePackage $package): bool {
|
||||
return $package->getPrettyName() === 'test/jsonInRootTarFile';
|
||||
});
|
||||
$this->assertCount(1, $tarPackage);
|
||||
self::assertCount(1, $tarPackage);
|
||||
$tarPackage = array_pop($tarPackage);
|
||||
$this->assertSame('tar', $tarPackage->getDistType());
|
||||
self::assertSame('tar', $tarPackage->getDistType());
|
||||
}
|
||||
|
||||
public function testAbsoluteRepoUrlCreatesAbsoluteUrlPackages(): void
|
||||
|
@ -68,7 +68,7 @@ class ArtifactRepositoryTest extends TestCase
|
|||
$repo = new ArtifactRepository($coordinates, new NullIO());
|
||||
|
||||
foreach ($repo->getPackages() as $package) {
|
||||
$this->assertSame(strpos($package->getDistUrl(), strtr($absolutePath, '\\', '/')), 0);
|
||||
self::assertSame(strpos($package->getDistUrl(), strtr($absolutePath, '\\', '/')), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class ArtifactRepositoryTest extends TestCase
|
|||
$repo = new ArtifactRepository($coordinates, new NullIO());
|
||||
|
||||
foreach ($repo->getPackages() as $package) {
|
||||
$this->assertSame(strpos($package->getDistUrl(), $relativePath), 0);
|
||||
self::assertSame(strpos($package->getDistUrl(), $relativePath), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue