1
0
Fork 0
Commit Graph

2831 Commits (bff129f4f57733298d97de6ac242b4b67c571eda)

Author SHA1 Message Date
Jordi Boggiano bbc442b0ad
Undo changes to providers, only unlock replacers when unlocking a given name 2021-11-23 16:11:44 +01:00
Jordi Boggiano 3242de2438
Backport tests from #9538 and fix everything 2021-11-23 13:07:19 +01:00
Jordi Boggiano 13b7527fca
Fix unlocking of replacers when a replaced package is unlocked in partial updates 2021-11-23 13:00:28 +01:00
Jordi Boggiano f509c41280
Upgrade PHPStan to 1.0 (#10253)
Co-authored-by: Martin Herndl <martin@herndl.org>
2021-11-14 20:42:24 +01:00
Jordi Boggiano 65765a148a
Explicitly deprecate misuse of the link setters to enforce the fact they expect maps (#10281) 2021-11-12 21:38:08 +01:00
Jordi Boggiano ce2a40b259
List identical/compatible removed versions in problem output as if they had not been removed 2021-11-11 16:13:25 +01:00
Yanick Witschi 34183f49f9
Implemented PoolOptimizer 2021-11-11 16:13:24 +01:00
Martin Herndl 7eca450d9b
Add wildcard support to ignore-platform-req, fixes #10045 (#10083) 2021-11-11 15:56:38 +01:00
Stephan 44c5b6cde6
Config: add source option for command to show where a config value is loaded from (#10129) 2021-11-11 15:17:58 +01:00
Martin Herndl 3013674c92
Refactor ignore platform reqs checks (#10079)
Introduces a `PlatformRequirementFilter` with methods that help to decide if a requirement is ignored or not as discussed in #10045 but without changing behaviour.
2021-11-11 12:24:12 +01:00
Jordi Boggiano 6aa8a466b7
Fix tests 2021-11-10 22:10:36 +01:00
Raphael de Almeida 150acc5559
Removed HgBitbucketDriver support (#10248) 2021-11-10 21:58:03 +01:00
Jordi Boggiano b09a39f9c8
Error out on recursive links in validating loader and ignore them in regular loader 2021-11-10 11:10:52 +01:00
Jordi Boggiano bd4d624cc7
Read first from $_SERVER and $_ENV before using getenv (#10218) 2021-11-09 16:31:27 +01:00
Martin Herndl 5b47fa1896
Add back abandoned key in repository search results (#10259) 2021-11-08 10:27:45 +01:00
Jordi Boggiano cb0293cf30
Finalize phpstan level 6 for tests dir, closes #10159 2021-11-02 14:32:09 +01:00
Jordi Boggiano 90087b4fb3
Fix handling of php bin proxies combined with declare() on php <8, fixes #10246 (#10249) 2021-11-02 11:36:31 +01:00
Martin Herndl bcbd8fdb61
Add types to `Package` tests (#10245) 2021-11-01 21:44:12 +01:00
megubyte a155c076db
phpstan: update tests/Composer/Test/DependencyResolver/* to level 6 standard (#10242) 2021-10-30 10:30:36 +02:00
megubyte 8b7e2b600d
phpstan: update tests/Composer/Test/Downloader/* to level 6 standard (#10238) 2021-10-30 10:21:50 +02:00
Martin Herndl 96370657b8
Fix phpstan return type in `SvnTest::urlProvider` (#10233) 2021-10-28 10:00:25 +02:00
Martin Herndl a861d66469
Add types to `EventDispatcher` tests (#10235) 2021-10-27 20:35:16 +02:00
Martin Herndl 467fe3c1be
Add types to `Config` tests (#10234) 2021-10-27 20:34:48 +02:00
Jordi Boggiano e5fc8a9c72
Fix phpstan error 2021-10-27 16:51:16 +02:00
Jordi Boggiano f8ad0bb3d1
Add types to the base TestCase 2021-10-27 16:37:20 +02:00
Jordi Boggiano 44b69ba77f
Upgrade php-cs-fixer to 3.x and fix CS 2021-10-27 16:21:45 +02:00
Jordi Boggiano c65d09dff7
Fix @inheritDoc annotations 2021-10-27 16:18:53 +02:00
Martin Herndl 2992e8651a
Add types to `Util` tests (#10228) 2021-10-27 16:18:46 +02:00
Martin Herndl d51c7685da
Add types to `Repository` tests (#10227) 2021-10-27 15:29:52 +02:00
jakobvibe d06eb1ec3a
Fix types on mock tests (#10230)
* Fix types on mock tests

* Added $tty again

Co-authored-by: Jakob Vibe <jv@ipw.dk>
2021-10-27 14:56:39 +02:00
jakobvibe 1ba1463013
Added types to plugin test (#10231)
Co-authored-by: Jakob Vibe <jv@ipw.dk>
2021-10-27 14:52:34 +02:00
megubyte c2a2198089
phpstan: update tests/Composer/Test/Installer/* to level 6 standard (#10225) 2021-10-27 14:41:30 +02:00
jakobvibe f667c7b8de
Add types to tests/composer/test/json (#10222)
Co-authored-by: Jakob Vibe <jv@ipw.dk>
2021-10-27 11:37:51 +02:00
megubyte 135f806f6f
phpstan: update tests/Composer/Test/Autoload/* to level 6 standard (#10223) 2021-10-26 21:48:56 +02:00
Martin Herndl 3d5a100018
Add types to `Question` tests (#10219) 2021-10-26 21:17:28 +02:00
Martin Herndl 79da1c266e
Add types to `Script` tests (#10220) 2021-10-26 21:08:54 +02:00
Christian 4071125172
Added return type docs (#10221) 2021-10-26 21:05:03 +02:00
Cédric Anne a7686e82f0
Filter candidates requiring an unknown platform package; fixes #10167 (#10184) 2021-10-26 17:24:17 +02:00
Martin Herndl bd8b39fe01
Add types to `Package` (#10210) 2021-10-25 13:45:09 +02:00
Martin Herndl aa4c2ab63c
Add types to `Plugin` (#10194) 2021-10-25 11:02:54 +02:00
Paolo Rossi a921d9b233
Reaching phpstan level 6 in EventDispatcher Exception and Installer folders (#10192) 2021-10-25 10:44:29 +02:00
immeëmosol 50d738eeee
Reaching phpstan level 6 in Composer/DependencyResolver (refs #10159) (#10178) 2021-10-18 22:33:37 +02:00
Jordi Boggiano a6f1e803b1
Use more BasePackage instead of PackageInterface 2021-10-17 14:43:34 +02:00
Jordi Boggiano 9599eb613b
Type annotations 2021-10-16 11:14:10 +02:00
Jordi Boggiano c3c6969cf5
Type annotations 2021-10-16 10:25:12 +02:00
Jordi Boggiano 97fe881af4
Add some docblocks 2021-10-15 16:36:28 +02:00
Jordi Boggiano 260ac0011c
Add constants to describe error codes from Installer::run 2021-10-14 15:12:06 +02:00
Jordi Boggiano cf7fa7087c
Fix test 2021-10-13 22:23:18 +02:00
Jordi Boggiano 2828ce59cf
Merge branch '1.10' 2021-10-13 22:12:54 +02:00
John Stevenson 906442117c Carriage returns are ignored by cmd 2021-10-13 14:54:37 +01:00
John Stevenson 0783b043d2 Fix Windows escaping in tests 2021-10-10 17:02:22 +01:00
John Stevenson 8f974fe741 Improve Windows escaping 2021-10-10 16:24:49 +01:00
Jordi Boggiano 18e24976c1
Merge branch '1.10' 2021-10-05 09:43:00 +02:00
Jordi Boggiano ca5e2f8d50
Fix escaping issues on Windows which could lead to command injection, fixes GHSA-frqg-7g38-6gcf 2021-10-05 09:39:50 +02:00
David Zülke 28b2b5c0c9
tests for solver handling multiple packages with same name and version (#10110)
Not a case with regular Packagist packages, but some custom installers with custom repos do this, and the current behavior should not randomly change at some point, as that would cause downstream breakage.
2021-10-02 19:02:22 +02:00
Jordi Boggiano d64d1adf61
Rewrite php file cleaning step to be less regex intensive and support extreme cases better, fixes #10106 (#10107) 2021-10-02 14:39:39 +02:00
Jordi Boggiano d99b200cf3
Fix tests 2021-10-01 10:54:33 +02:00
Jordi Boggiano f85e2136fd
Merge branch '1.10' 2021-10-01 10:34:36 +02:00
Jordi Boggiano 8cd2d0e541
Fix scanning of classmaps in files containing invalid Unicode, fixes #10102 2021-09-15 11:31:43 +02:00
Jordi Boggiano 4bcd860b65
Add more type annotations 2021-09-05 17:34:12 +02:00
Jordi Boggiano dd49db6f08
Make sure that names with wildcards which are not preceded by dots are also seen as package names and not version constraints 2021-09-05 09:56:28 +02:00
Jordi Boggiano 0761474599
Add type info to many properties/methods 2021-08-30 14:46:49 +02:00
Jordi Boggiano f4e2b389a1
Fix test 2021-08-29 20:10:24 +02:00
Jordi Boggiano 922ba01d07
Merge pull request #10072 from jrfnl/feature/10067-fix-classmap-regression
ClassMapGenerator: stabilize the heredoc/nowdoc stripping
2021-08-29 12:26:20 +02:00
Jordi Boggiano d8054d1d2f
Add more possessive quantifiers, unicode flag and support for more post-heredoc syntax, fix test file syntax being invalid 2021-08-29 12:23:02 +02:00
Jordi Boggiano 3f79e59f69
Add test assertions for heredoc marker inside the text 2021-08-23 13:14:16 +02:00
powellblyth 5e75017166
Just some comments with 'it's' that should have been 'its' (#10071)
Co-authored-by: Toby Powell-Blyth <tobypowell-blyth@elasticstage.com>
2021-08-22 13:41:18 +02:00
jrfnl b66b23a03f
ClassMapGeneratorTest: add test with consecutive duplicate heredoc markers
... as well as a test with heredoc markers with only a newline character between the start and end marker.
2021-08-21 17:45:42 +02:00
Jordi Boggiano d3c176ec69
PHPStan Level 5 (#10070)
* Bump PHPStan to level 5

* Update seld/phar-utils to latest

* Add phpstan-setup / phpstan scripts
2021-08-21 17:41:52 +02:00
Jordi Boggiano 74b231a4bc
Fix lib-openssl detection on FreeBSD, fixes #10046 2021-08-19 15:00:08 +02:00
Jordi Boggiano a586a753df
Fix all remaining php8.1 test suite deprecations 2021-08-19 13:00:30 +02:00
Jordi Boggiano b77fce8a4f
More deprecation fixes by using ProcessExecutorMock and a couple of PackageInterface type fixes 2021-08-18 23:35:27 +02:00
Jordi Boggiano 6aa2d15868
Introduce ProcessExecutorMock to fix deprecations and amount of mocking pain 2021-08-18 17:17:56 +02:00
Jordi Boggiano 5062619046
Fix deprecation warnings with strpos receiving null 2021-08-18 15:55:37 +02:00
Jordi Boggiano 0b09e08f4b
Fix direct deprecations 2021-08-18 15:17:06 +02:00
Jordi Boggiano cac4c190f1
Merge pull request #10053 from jrfnl/feature/php-8.1-null-to-non-nullable-fix-2
PHP 8.1: prevent a "null to non-nullable" deprecation notice [2] (test only fix)
2021-08-18 14:39:51 +02:00
Jordi Boggiano 9708f4568f
Merge pull request #10055 from jrfnl/feature/php-8.1-fix-missing-mock-expectation
PHP 8.1/LibraryInstallerTest: add missing mock expectation
2021-08-18 14:31:30 +02:00
Jordi Boggiano b232ee6663
Fix test 2021-08-18 14:25:35 +02:00
jrfnl 7004e0d031 PHP 8.1/LibraryInstallerTest: add missing mock expectation
The `LibraryInstallerTest::testUninstall()` method mocks a `Package` object, but did not set an expectation for a call to `getName()`, while that method _is_ called in the `LibraryInstaller::uninstall()` method.

Without expectation, the mock returns `null`, which was subsequently being passed on to `strpos()` leading to the below error.

Fixes:
```
Deprecation triggered by Composer\Test\Installer\LibraryInstallerTest::testUninstall:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 202)
1 src/Composer/Installer/LibraryInstaller.php(202): strpos(NULL, '...')
2 vendor/react/promise/src/FulfilledPromise.php(28): Composer\Installer\LibraryInstaller->Composer\Installer\{closure}(NULL)
3 src/Composer/Installer/LibraryInstaller.php(208): React\Promise\FulfilledPromise->then(Object(Closure))
4 tests/Composer/Test/Installer/LibraryInstallerTest.php(221): Composer\Installer\LibraryInstaller->uninstall(Object(Mock_InstalledRepositoryInterface_e3699f95), Object(Mock_Package_e4571076))
...
```
2021-08-12 03:38:56 +02:00
jrfnl 7022ceb0a6 PHP 8.1: prevent a "null to non-nullable" deprecation notice (test only fix)
Not all tests in the `InstallerTest` class actually create a temporary directory and set the `$this->tempComposerHome` property.

Those tests which didn't, throw a notice in PHP 8.1.

Fixes 3 notices along the lines of:
```
Deprecation triggered by Composer\Test\InstallerTest::tearDown:
is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 53)
1 tests/Composer/Test/InstallerTest.php(53): is_dir(NULL)
...
```
2021-08-12 03:02:19 +02:00
jrfnl e729c418dd ClassMapGenerator: add test for "marker in text" bug
In PHP < 7.3, the heredoc/nowdoc marker was allowed to occur in the text, as long as it did not occur at the very start of the line.

This was also not handled correctly.

Ref: https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.heredoc-nowdoc
2021-08-11 22:23:24 +02:00
jrfnl 9588654ae3 ClassMapGenerator: add tests for "long heredoc" bug
... to proof the existence of the bug and demonstrate the effect.

Note: in the test the backtrack limit is being lowered (and restored back to the default afterwards) to prevent the tests needing ridiculously huge test fixture files.
2021-08-11 22:21:57 +02:00
Stephan c65bd832d6
Url: fix sanitize for new github tokens (#10048) 2021-08-11 13:24:41 +02:00
Juliette f5a0dfeb50
PHP 8.1: fix deprecation warnings about incorrect default values (#10036)
* PHP 8.1/Tests: fix some deprecation warnings

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes numerous `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1/NoProxyPattern: fix deprecation warning

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes some `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

```
Deprecation triggered by Composer\Test\Util\Http\ProxyManagerTest::testGetProxyForRequest:
preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 42)
1 src/Composer/Util/NoProxyPattern.php(42): preg_split('...', '...', NULL, 1)
2 src/Composer/Util/Http/ProxyManager.php(148): Composer\Util\NoProxyPattern->__construct('...')
3 src/Composer/Util/Http/ProxyManager.php(50): Composer\Util\Http\ProxyManager->initProxyData()
4 src/Composer/Util/Http/ProxyManager.php(59): Composer\Util\Http\ProxyManager->__construct()
5 tests/Composer/Test/Util/Http/ProxyManagerTest.php(75): Composer\Util\Http\ProxyManager::getInstance()
...
```

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1: fix deprecation warnings / http_build_query()

This fixes all relevant calls to the PHP native `http_build_query()` function.
The second parameter of which is the _optional_ `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.
In this case, these function calls yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without BC-break.

Fixes a few deprecation warnings found when running the tests.

Refs:
* https://www.php.net/manual/en/function.http-build-query.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

* PHP 8.1: fix deprecation notices / PharData::__construct()

This fixes all relevant calls to the PHP native `PharData::__construct()` method.

The second parameter of this method is the _optional_ `$flags` parameter which expects an `int` of flags to be passed to the `Phar` parent class `RecursiveDirectoryIterator`.
Fixed by passing the default value for the `$flags` parameter as per the `RecursiveDirectoryIterator::__construct()` method.

The third parameter of the method is the _optional_ `$alias` parameter which expects an `string`.
Fixed by passing an empty string.

Fixes various notices along the lines of:
```
Deprecation triggered by Composer\Test\Package\Archiver\ArchiveManagerTest::testArchiveTar:
PharData::__construct(): Passing null to parameter #2 ($flags) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 55)
1 src/Composer/Package/Archiver/PharArchiver.php(55): PharData->__construct('...', NULL, NULL, 2)
2 src/Composer/Package/Archiver/ArchiveManager.php(193): Composer\Package\Archiver\PharArchiver->archive('...', '...', '...', Array, false)
3 tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php(65): Composer\Package\Archiver\ArchiveManager->archive(Object(Composer\Package\CompletePackage), '...', '...')
...
```

Refs:
* https://www.php.net/manual/en/phardata.construct.php
* https://www.php.net/manual/en/recursivedirectoryiterator.construct.php

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-08-11 13:05:45 +02:00
Jordi Boggiano df99150db6
Pin versions to avoid new dependencies breaking tests 2021-08-04 16:39:19 +02:00
Jordi Boggiano 24f5e54fbe
Fix only/exclude to avoid matching names as sub-strings of full package names, fixes #10001 2021-07-22 13:47:31 +02:00
Jordi Boggiano 10ae1d7b08
Fix some PHP 8.1 deprecation warnings, fixes #10008 2021-07-21 15:13:24 +02:00
Jordi Boggiano 005c55185a
Fix support for writing into UNC paths, and comparing UNC paths correctly in InstalledVersions, fixes #9993 2021-07-12 14:03:00 +02:00
Jordi Boggiano cc81f5bac3
Fix support for UNC paths in normalizePath, refs #9993 2021-07-12 13:36:57 +02:00
Jordi Boggiano a02802b109
Warn 1.x users when a package is not found that it may be due to our deprecation policy 2021-06-08 21:12:49 +02:00
adlacruzes 7366b8e362 Fix JsonFile when using custom json schema with no "name" and "description" properties 2021-06-03 20:15:35 +02:00
Jordi Boggiano 1b34495daa
Some phpstan level 4 fixes 2021-06-03 11:29:00 +02:00
Jordi Boggiano 4c9e75c6e5
Fix CS 2021-06-03 10:38:38 +02:00
Jordi Boggiano 91dd175f74
Fix env var handling when variables_order includes E and symfony/console 3.3.15+ is used, fixes #9930 2021-06-03 10:17:54 +02:00
Jordi Boggiano 8bf0ddf905
Clean up ZipDownloader, always do async first if possible then fallback to non-async 2021-06-02 15:13:19 +02:00
Nils Adermann 1ca6397442
Merge pull request #9765 from Seldaek/always_sync_symlinked_path_pkgs
Always mark symlinked path packages for update even during partial updates to make sure they always reflect the current state on disk
2021-06-02 11:50:15 +02:00
Jordi Boggiano 1f37d1c1d5
Add better error reporting for cases where a package conflicts with a replace and not directly a package, fixes #9834 2021-06-02 10:08:13 +02:00
Brad Jones dd625669e8
Introduce gitlab-protocol option to force the gitlab repos to use https or git protocol (#9401) 2021-05-27 23:05:53 +02:00
Jordi Boggiano 0dce0f80f1
Also hint for errors when the root package does not match the constraint 2021-05-25 23:05:44 +02:00
Nils Adermann 21c70c2606
Merge pull request #9902 from Seldaek/cyclic-deps
Detect and output a better hint for cyclic dependencies
2021-05-25 22:58:50 +02:00
Jordi Boggiano cbef7b9172
Detect and output a better hint for dependencies on the root package, fixes #9837 2021-05-25 22:47:53 +02:00
Jordi Boggiano 084fff2014
Merge remote-tracking branch 'guilliamxavier/lax-schema' 2021-05-24 22:27:48 +02:00
Jordi Boggiano 44e6591573
Improve error reporting for exts overridden by platform config, fixes #9876 2021-05-24 16:57:33 +02:00
Guilliam Xavier 393c9a5946 Add more tests 2021-05-24 14:42:23 +02:00
Guilliam Xavier 2d21dd675a Invert strict/lax schema validation 2021-05-24 11:51:04 +02:00
Guilliam Xavier 9e2cb30dfb Revert "Merge remote-tracking branch 'BoShurik/schema'"
This reverts commit 89c3045e2b, reversing
changes made to 991985792d.
2021-05-24 11:46:08 +02:00
Jordi Boggiano da3d5e3143
Merge pull request #9699 from ochorocho/improve-installed-versions-9648
Add install-path and type to installedVersions.php and installed.php,…
2021-05-24 10:29:40 +02:00
Jordi Boggiano f0e178c318
Merge branch '2.0' 2021-05-21 16:49:42 +02:00
Jordi Boggiano 17f6363ea9
Fix tests 2021-05-21 16:49:17 +02:00
John Stevenson ce19bcd992
Upgrade to xdebug-handler 2 (#9832)
This adds support for Xdebug3 modes and changes the default behaviour
from always restarting if Xdebug is loaded, to only restarting if Xdebug
is active.

Xdebug is considered active if it is loaded, and for Xdebug3, if it is
running in a mode other than `xdebug.mode=off`.
2021-05-21 16:47:29 +02:00
Jordi Boggiano 3fe4f84a76
Fix handling of metapackages with null paths, and handling of paths which do not have a shortest-path and require an absolute path to be addressed 2021-05-21 14:33:10 +02:00
Jordi Boggiano 518b44a810
Clean up dump code to avoid reimplementing var export, and remove DIRECTORY_SEPARATOR 2021-05-21 14:33:10 +02:00
Jochen Roth b6c9d34125
Add install-path and type to installedVersions.php and installed.php, add method to get installed packages by type
Issue https://github.com/composer/composer/issues/9648
2021-05-21 14:33:09 +02:00
Jordi Boggiano 89c3045e2b
Merge remote-tracking branch 'BoShurik/schema' 2021-05-20 15:42:39 +02:00
Jordi Boggiano ac49e61931
Add more tests
Co-authored-by: Guilliam Xavier <guilliamxavier@users.noreply.github.com>
2021-05-20 15:41:56 +02:00
Jordi Boggiano 991985792d
Merge branch '2.0' 2021-05-20 14:16:52 +02:00
Guilliam Xavier 8d8842eb8c
Fix schema minimum-stability pattern 2021-05-20 14:15:39 +02:00
Nils Adermann 05caeb008f
Merge pull request #9887 from Seldaek/require-exts-simpler
Use a simpler suggested require version of * to keep things simple for extensions which are versioned like PHP
2021-05-17 14:47:29 +02:00
Jordi Boggiano 459a7d9623
Use a simpler suggested require version of * to keep things simple for extensions which are versioned like PHP, fixes #9483 2021-05-17 14:36:46 +02:00
Michael Voříšek 5456cf8197
Fix EOL of text files (#9877) 2021-05-12 15:19:52 +02:00
Jordi Boggiano 9b7a8d4543
Hint at a branch rename if we detect dev-master can not be found but dev-main or dev-default exists, fixes #9850 2021-05-03 14:42:58 +02:00
Jordi Boggiano 832f4007d6
Allow ints in source/dist reference 2021-04-30 09:40:58 +02:00
Jordi Boggiano 832af78e28
Add basic source/dist validation 2021-04-28 21:53:09 +02:00
Jordi Boggiano 40c7a725e1
Merge branch '2.0' 2021-04-27 13:06:49 +02:00
Jordi Boggiano 332c46af8b
Merge pull request from GHSA-h5h8-pc6h-jvvx
* Fix external process calls to avoid user input being able to pass extra parameters

* Tweak some fixes
2021-04-27 13:00:40 +02:00
Jordi Boggiano 083b73515d
Merge pull request from GHSA-h5h8-pc6h-jvvx
* Fix external process calls to avoid user input being able to pass extra parameters

* Tweak some fixes
2021-04-27 13:00:40 +02:00
Andreas Scheibel bb1bb022e4
"composer init --autoload" - Interactive generates PSR-4 autoloader in composer.json (#9829)
- Generates PSR-4 autoload entry in composer.json.
- Run dump-autoload, if no dependencies are set
2021-04-20 21:58:38 +02:00
John Stevenson c3b76a8532
Upgrade to xdebug-handler 2 (#9832)
This adds support for Xdebug3 modes and changes the default behaviour
from always restarting if Xdebug is loaded, to only restarting if Xdebug
is active.

Xdebug is considered active if it is loaded, and for Xdebug3, if it is
running in a mode other than `xdebug.mode=off`.
2021-04-13 09:59:06 +02:00
Jordi Boggiano d75d79b452
Merge pull request #9822 from phenaproxima/post-file-download
Fire POST_FILE_DOWNLOAD event for metadata fetched by ComposerRepository
2021-04-09 14:53:20 +02:00
Jordi Boggiano 7dd95a768b
Clean stuff up and deprecate old usages for PostFileDownloadEvent 2021-04-09 11:21:13 +02:00
Jordi Boggiano 549dabf878
Merge branch '2.0' 2021-04-08 12:06:38 +02:00
Jordi Boggiano e6cede4a61
Make sure update mirrors/--lock keeps the release date of the original reference when dev versions have newer commits, refs #9812 2021-04-08 11:54:39 +02:00
Jordi Boggiano 0ab4013788
Fix output listing some updates that do not really happen when updating mirrors/--lock, fixes #9812 2021-04-08 10:55:48 +02:00
Jordi Boggiano 101a5e2a21
Merge branch '2.0' 2021-04-07 16:05:26 +02:00
Jordi Boggiano 3e33cc1d93
Add new dep to the tests 2021-04-07 16:02:41 +02:00
Jordi Boggiano 1ce41efa6a
Fix tests 2021-04-07 14:39:42 +02:00
Jordi Boggiano 1179e4b481
Change root.dev-requirement to root.dev in installed.php as the root is not required per se, and this simply tracks the dev mode at install time 2021-04-07 13:42:22 +02:00
BoShurik cc55b56dd7 Allow optional name and description fields for project type 2021-03-30 16:51:03 +03:00
Jordi Boggiano bf73a20bc0
Merge branch '2.0' 2021-03-16 20:31:44 +01:00
Jordi Boggiano 44bb82b50f
Make full functional test output more reliable 2021-03-10 14:37:00 +01:00
Jordi Boggiano f10ae542ff
Always mark symlinked path packages for update even during partial updates to make sure they always reflect the current state on disk, fixes #9751 2021-03-10 14:26:42 +01:00
Jordi Boggiano 4940009f83
Bump phpstan to level 3 (#9734)
Clean up PackageInterface/CompletePackageInterface, add missing methods, type things in solver as BasePackage, added CompleteAliasPackage, ..
2021-03-09 15:49:40 +01:00
Jordi Boggiano 8392508e23
Merge branch '2.0' 2021-03-09 15:29:19 +01:00
Jordi Boggiano ab84916422
Fix unclear error when a package can be found in lock but not in the remote repo, fixes #9750 2021-03-09 15:01:23 +01:00
Jordi Boggiano d0b399b788
Merge branch '2.0' 2021-03-09 09:54:39 +01:00
Jordi Boggiano 0879e80d56
Fix functional tests to use the same PHP version as PHPUnit runs with 2021-03-09 09:54:06 +01:00
Jordi Boggiano 40800df6bd
Fix CS 2021-02-25 13:46:52 +01:00
Jordi Boggiano 46dde9453b
Fix tests 2021-02-25 11:28:07 +01:00
Jordi Boggiano 7c555b6382
Merge pull request #9682 from nicolas-grekas/installed-no-dev
Allow querying InstalledVersions::isInstalled() for no-dev packages
2021-02-24 17:16:28 +01:00
Jordi Boggiano 09639a0cfc
Merge pull request #9670 from Ayesh/enums
Add support for autoloading Enums
2021-02-24 16:03:58 +01:00
Jordi Boggiano 7c910e6bfa
Revert autoload order fix, force bundled dependencies to be used over local dependencies, fixes #9721, fixes #9717 2021-02-24 14:55:13 +01:00
Nicolas Grekas 7d4501816c Allow querying InstalledVersions::isInstalled() for no-dev packages 2021-02-18 13:15:26 +01:00
Jordi Boggiano 03e8cacd12
Merge pull request #9696 from Seldaek/fix_installed_versions_during_update
Fix installed versions usage issues when using it in plugins during a Composer update process
2021-02-18 10:37:22 +01:00
Jordi Boggiano 22e79684ee
Fix unzip missing support for testsuite 2021-02-17 23:51:08 +01:00
Jordi Boggiano d91fe67a80
Remove default branch alias from versions which are numeric, fixes #9705 2021-02-17 23:48:03 +01:00
Jordi Boggiano 6035e462d8
Fix test when on feature branch 2021-02-17 23:43:35 +01:00
Jordi Boggiano a54d16f8a6
Fix tests env usage 2021-02-17 23:26:40 +01:00
Jordi Boggiano f7e8f7625f
Remove plugin installer hackery 2021-02-17 23:21:18 +01:00
Jordi Boggiano 7267533690
Add one more InstalledVersions test for upgrades showing a known issue with plugin upgrades 2021-02-15 17:57:57 +01:00
Jordi Boggiano 27d0c5c3ef
Add test deficiencies in installed versions as the runtime autoloaders are not prepended and do not grant access to the latest data 2021-02-12 11:12:42 +01:00
Jordi Boggiano d3ba447b79
Full functional test-bed improvements 2021-02-12 11:09:00 +01:00
Jordi Boggiano 52d7c6c383
Fix/add tests and also handle case where a json object is used 2021-02-11 11:13:58 +01:00
Jordi Boggiano 902174d2a7
Improve error reporting when failing to load a package, fixes #9680 2021-02-10 11:24:59 +01:00
Ayesh Karunaratne 228428747a
Add support for autoloading Enums
PHP 8.1 supports Enums, and [Enums follow class-semantics](https://php.watch/versions/8.1/enums#class-semantics-autoload).

Composer's class-map generator currently looks for `class`, `interface`, and `trait` keywords. If Composer is run in PHP 8.1 or later, Composer now additionally looks for `enum` keyword as well. This is similar to how Hack's `enum` support is added.

This PR also adds tests for basic enums, backed enums, namespaced enums, and an enum that implements an interface and extends a class.
2021-02-06 15:51:18 +07:00
Arnaud Vanwambeke 7402ef33fc Dont recommend to use with all dependencies option when it is already used 2021-02-03 23:43:35 -05:00
Jordi Boggiano 5e956afa2f
Try fixing the build 2021-02-01 13:32:34 +01:00
Jordi Boggiano 07b8c23f02
Merge branch '1.10' 2021-01-27 15:46:58 +01:00
Jordi Boggiano 37c5e9961c
Merge remote-tracking branch 'nicolas-grekas/path-version' into 1.10 2021-01-27 15:20:38 +01:00
Jordi Boggiano 92313447d6
Filter out exclude-from-classmap rules to avoid generating very long regexes, fixes #9487 2021-01-27 15:10:32 +01:00
Nicolas Grekas 725b33ee5a Handle "versions" option in PathRepository, remove support for "branch-version" 2021-01-27 14:28:26 +01:00
Nicolas Grekas 079e501ac8 Revert "Merge pull request #9273 from nicolas-grekas/dev-version"
This reverts commit d2d606ced2, reversing
changes made to 4a8dbcd145.
2021-01-27 14:03:44 +01:00
Jordi Boggiano 51001dec60
Merge remote-tracking branch 'nicolas-grekas/install-stack' 2021-01-27 11:04:09 +01:00
Nicolas Grekas ba94445bb9 Ensure InstalledVersions reports info about all currently registered class loaders 2021-01-27 10:39:35 +01:00
Jordi Boggiano 6c346d00f3
Merge pull request #9617 from clxmstaab/merge-checkout-reset
GitDownloader: combine checkout + reset commands into a single process
2021-01-26 11:01:58 +01:00
Jordi Boggiano 471a63c206
Merge pull request #9465 from BR0kEN-/issues/9464
#9464: ZipArchiver incorrectly treats `.gitignore` directory inclusions
2021-01-26 10:42:26 +01:00
Markus Staab 4a6f1792ea adjusted test expectations 2021-01-18 10:11:08 +01:00
Jordi Boggiano d8a5db4cbb
Fix tests 2021-01-12 14:59:21 +01:00
Jordi Boggiano 57117384df
Merge pull request #9601 from Seldaek/json-fix
Fix JSON manipulation issue with large files and jit enabled
2021-01-12 14:45:13 +01:00
Jordi Boggiano d94e638461
Fix tests and edge case 2021-01-12 14:00:02 +01:00
Jordi Boggiano b021647e6f
Fix JSON manipulation issue with large files and jit enabled, fixes #9595 2021-01-12 11:02:43 +01:00
Jordi Boggiano 7f3a56f39b
Merge pull request #9360 from naderman/pool-builder-unlock-consider-all-constraints
PoolBuilder: Ensure versions matching locked constraints get loaded
2020-12-03 16:59:39 +01:00
Nils Adermann db0656eab0 Duplicate partial update unlock but keep old version test with provide keyword 2020-12-01 14:55:05 +01:00
Jordi Boggiano 62bd81bf7a
Make sure the default branch alias is never used as a constraint by the VersionSelector 2020-11-26 14:24:22 +01:00
Jordi Boggiano d00edab884
Merge pull request #9477 from naderman/fix-alias-conflicts
Explicit conflicts should conflict with aliases of packages too
2020-11-26 13:59:57 +01:00
Jordi Boggiano e203809106
Fix test description 2020-11-26 13:59:35 +01:00
Nils Adermann 7197278fe9 Always install aliases together with their original package
Restores some Composer 1.x behavior like unbound constraints conflicting
with default branches unless they are branch aliased.

Simplifies conflicts with aliases because packages cannot be installed
without their aliases, so we do not need to know which aliases are
uninstalled in lock file or installed.json.
2020-11-26 12:10:07 +01:00
Jordi Boggiano e857a8216c
Make sure mirror update fails if no lock file is present 2020-11-26 11:28:17 +01:00
Jordi Boggiano 2d025dce05
Make sure mirror updates do not fail if there are dev requirements and new requires are present, fixes #9514 2020-11-26 11:27:44 +01:00
Nils Adermann 58f358d028 Correct test case descriptions 2020-11-26 11:21:53 +01:00
Jordi Boggiano b7d770659b
CS fixes 2020-11-22 14:52:39 +01:00
Jordi Boggiano 152694b574
Fix tests 2020-11-22 14:31:38 +01:00
Andrés De la Cruz 480a6439fd
Fix phpstan phpdocs issues (#9478) 2020-11-20 09:28:09 +01:00
Nils Adermann 1b337be236 Add expected lock files to conflict with branch alias tests, add install from lock test 2020-11-16 13:27:54 +01:00
Nils Adermann c02d2842b0 Test conflict with an unrequired alias does not prevent install.
The alias still ends up being marked as installed as the install step
reads it from the branch alias in the lock file and doesn't know a
conflict required it to be skipped.
2020-11-13 16:55:35 +01:00
Nils Adermann 045b5c6b6b Add test case verifying conflicts on alias prevent it from getting installed 2020-11-13 15:47:27 +01:00
Nils Adermann 6b48258432 Add test case for root alias on an unloadable package 2020-11-13 14:40:54 +01:00
Jordi Boggiano 7b183956d8
Make sure the root aliases always get installed when a package is updated, fixes #9448 2020-11-13 13:52:21 +01:00
Sergii Bondarenko 1ec5fa81e4
#9464: Add the test to reveal the issue 2020-11-12 13:12:55 +02:00
Jordi Boggiano e5a009ed80
Make sure empty objects are not left behind when removing requires/.. fixes #9462 2020-11-12 11:09:15 +01:00
Jordi Boggiano b574f10d9d
Rename mainPackage to rootPackage in AutoloadGenerator and ensure we use RootPackageInterface 2020-11-12 10:41:06 +01:00
Jordi Boggiano b8e40f6060
Fix tests 2020-11-11 11:49:50 +01:00
Jakub Bouček 8dc5effee7
AutoloadGenerator: Send error HTTP status on error 2020-11-05 09:57:48 +01:00
Jordi Boggiano 56c65a58e2
Make platform-check only check non-dev requires, refs #9412 2020-11-04 23:41:58 +01:00
Jordi Boggiano 8c1355f448
Improve output of platform check further in case errors are hidden 2020-11-04 22:28:17 +01:00
Jordi Boggiano ec960d12b0
Merge remote-tracking branch 'jakubboucek/feature/jb-platform-check-tigger-error' 2020-11-04 21:54:12 +01:00
Jordi Boggiano 4797d4afc8
Fix tests 2020-11-04 21:24:30 +01:00
Jakub Bouček 2595de07ce
AutoloadGenerator: Trigger native PHP error on platform checks fails - tests 2020-11-04 12:28:15 +01:00
Jakub Bouček 6f1761fe18
AutoloadGenerator: Send error HTTP status on error - update tests 2020-11-04 11:18:21 +01:00
Tanel Pipar ad2fcf8d92 Close zip archive after test finishes 2020-11-03 12:27:15 +02:00
Tanel Pipar b57792a80a Skip CWD-in-path test on Windows 2020-11-03 12:20:44 +02:00
Tanel Pipar 4d05cbffe3 Remove CWD from only the beginning of a path in ZipArchiver
Fixes https://github.com/composer/composer/issues/9403
2020-11-03 12:04:02 +02:00
Tanel Pipar 8f454c6708 Remove CWD from only the beginning of a path in ZipArchiver
Fixes https://github.com/composer/composer/issues/9403
2020-11-03 12:01:48 +02:00
zorn 5aa90baab1 Add new lines to platform reqs issues 2020-11-01 23:39:06 +10:00
Jordi Boggiano 28e591dcd4
Merge pull request #9387 from studioromeo/fix-git-non-master-default-failing-tests
Fix git init -b being unavailable for older versions
2020-10-30 18:03:00 +01:00
Robert Rhoades 2ced7b0bf8 Fix git init -b being unavailable for older versions
On older versions of git init doesn't have the -b flag. That
was introduced in v2.28.0.

Instead switch to using git checkout -b which has much
wider support (2.4.12 was as far back as I could check on
the docs).
2020-10-30 16:58:32 +00:00
Jordi Boggiano 372af31d23
Fix tests 2020-10-30 17:40:35 +01:00
Jordi Boggiano f2f3b03fec
Fix config/create-project handling of repositories to prepend them by default as this is most likely the goal, fixes #9371 2020-10-30 14:16:40 +01:00
Jordi Boggiano 41daf69c87
Merge pull request #9379 from glaubinix/f/zip-util
Zip: ignore mac osx specific folder when searching for composer.json
2020-10-30 10:48:31 +01:00
Stephan Vock d97c37f103 Zip: ignore mac osx specific folder when searching for composer.json 2020-10-29 22:30:12 +00:00
Robert Rhoades e6c7ab693e Fix running tests with non standard default branch
When the global git config has init.defaultbranch set to
something other than master the tests fail. This is because
the tests assume that the default branch is called master
but that may not be the case.

This fixes the tests by ensuring that when running git init
we ensure the default branch is called master regardless of
how git is configured.
2020-10-29 21:16:11 +00:00
Nils Adermann 63bed40818 PoolBuilderTest: Add a dependency which must not be loaded on unlock 2020-10-27 22:18:05 +01:00
Nils Adermann ea42d13f37 PoolBuilderTest: check locked constraints are considered on partial update 2020-10-27 21:59:12 +01:00
Jordi Boggiano ff74d0e686
Fix lock file generation with dev-master aliases to be compatible with Composer 1, fixes #9337 2020-10-27 20:50:26 +01:00
Nils Adermann 7bc2112f2b InstallerTest: Add a test for partial updates
Needs to take constraints of locked packages into account
2020-10-27 17:02:31 +01:00
Nils Adermann b5c0e68bc7 PoolBuilder: test case ensuring versions matching locked constraints get loaded 2020-10-27 16:52:31 +01:00
Jordi Boggiano 568d9206cc
Fix tests 2020-10-27 14:04:36 +01:00
Jordi Boggiano 4b8c2aa121
Fix default version to be semver parseable, fixes #9342 2020-10-25 22:22:19 +01:00
Jordi Boggiano 5bdb0cfff5
Merge pull request #9339 from Seldaek/fix-plugin-order
Fix plugin install order for plugins modifying downloads
2020-10-25 21:28:38 +01:00
Jordi Boggiano 2d4e1e0dce
Make sure Transaction sorts operations correctly to begin with 2020-10-25 14:06:45 +01:00
johnstevenson 2a913c7a68 Improve proxy error messages for streams 2020-10-24 18:20:31 +01:00
Jordi Boggiano 62eff8e979
Tweaks to new proxying code, refs #9324 2020-10-24 10:36:39 +02:00
johnstevenson d47261eb93 Refactor proxy handling for Composer2 2020-10-23 21:38:29 +01:00
Nils Adermann e868996bdd Validate: Warn about providing or replacing packages you require 2020-10-23 22:02:13 +02:00
Jordi Boggiano 8564dd8dac
Allow Url::sanitize to escape URLs without scheme 2020-10-23 13:27:46 +02:00
johnstevenson 8feb83b22b
Remove duplicate StreamContextFactory ssl options
Added in Dec 2014 (commit 8dad846), superseded in Jan 2016 (pr #4759)
2020-10-23 13:25:17 +02:00
Jordi Boggiano 4d2f41a415
Merge pull request #9318 from naderman/validate-provide-replace-requirement
Validate: Warn about providing or replacing packages you require
2020-10-23 10:35:26 +02:00
Jordi Boggiano 447416a357
Fix typo 2020-10-22 16:16:02 +02:00
Nils Adermann 6409ed0fc2 Validate: Warn about providing or replacing packages you require 2020-10-22 11:28:19 +02:00
Jordi Boggiano 492bece6e2
Merge pull request #9317 from naderman/test-provider-satisfy-self
Test: Verify require for package provided or replaced by pkg itself is used
2020-10-22 10:46:05 +02:00
Nils Adermann 1d6c0865ca Test: Verify replacing a package required by the same package satisfies the dep 2020-10-22 10:32:04 +02:00
Nils Adermann 290450214e Test: Verify require for package provided by pkg itself is used 2020-10-22 10:26:28 +02:00
Nils Adermann c0236c5ed2 Move slow integration test to separate fixtures directory and add to slow group 2020-10-22 10:14:17 +02:00
Nils Adermann c37dce0bb3 Remove unnecessary hhvm conflict rules from test 2020-10-22 10:02:09 +02:00
Nils Adermann 2468cd20dd Update test case for github issue 7665 to have correct output 2020-10-22 09:44:16 +02:00
Nils Adermann e11f52c041 Add a test to reproduce github issue #7665 2020-10-22 09:44:16 +02:00
Jordi Boggiano b74afd772b
Merge pull request #9309 from naderman/fix-solver-9290
MultiConflictRule conflict analysis handling on level 1 decisions
2020-10-21 18:40:03 +02:00
Nils Adermann 7b4cb9c370 Solver: Prevent infinite recursion in analyzeUnsolvableRule
In complex scenarios reasons for learned rules can themselves be learned
rules caused by other learned rules which had the some of the same
reasons. In this situation iterating over all problem rules requires
keeping track of which rules have previously been analyzed to avoid and
endless loop.

Side effect is that the sorting of problems including learned rules
changes slightly.
2020-10-21 17:11:13 +02:00
Nils Adermann 9641ad6025 SolverProblemException: Hide learnt rules on output
Results in too much error output which is not helpful. Very repetitive
and hard to understand. In issue 8903 even leads to endless recursion
bug.
2020-10-21 14:08:12 +02:00
Nils Adermann 853305063d Add test case for github issue 9290 2020-10-21 13:33:39 +02:00
Jordi Boggiano 99a5469b5e
More hints 2020-10-18 13:13:44 +02:00
Jordi Boggiano 4d005a9786
Merge pull request #9296 from mcaskill/bugfix/file-downloader-cache-keys
Fix availability of $urls in FileDownloader
2020-10-16 11:24:03 +02:00
Jordi Boggiano c01e3bd2f0
Make async test more robust 2020-10-16 11:23:03 +02:00
Chauncey McAskill fcc072fdb6 Add test to check processed URL and cache key 2020-10-15 23:46:12 -04:00
Nils Adermann fdde9e5933 On composer install we fix locked packages, but consider them locked for error reporting 2020-10-14 11:46:13 +02:00
Nils Adermann 74fb313c39 Separate locked packages from fixed packages in request
Locked packages are basically like removable fixed packages, so we still
only load one version, but we do not require their installation unless
something the user needs requires their use. So they automatically get
removed if they are no longer needed on any update.
2020-10-14 11:46:13 +02:00
Nils Adermann 73e24ea9fb Partial updates should remove all unused dependencies
Instead of marking locked packages as fixed, we change the pool builder
to load only the locked version and treat it like a fixed package, but
removing the actual request fix, makes the solver treat it as a regular
optional dependency. As a consequence locked packages may be removed on
a partial update of another package, but they cannot be updated.
2020-10-14 11:46:13 +02:00
Nils Adermann 85eb007f4f Transaction: Define a total order on packages to keep behavior on PHP8
So far the ordering of alias packages with the same name was undefined
so the actual order was determined by implementation of the sorting
algorithm in PHP. As of PHP8 sort is stable by default which changes the
outcome in some of our test cases.

With the fully defined total order the order can longer change depending
on sorting algorithm used and remains the same across PHP versions.
2020-10-14 11:13:51 +02:00
Jordi Boggiano 7ea6d5d2e7
Merge branch '1.10' 2020-10-13 16:00:04 +02:00
Nicolas Grekas 4feed8b85c Fix parsing "branch-version" 2020-10-13 15:43:12 +02:00
Jordi Boggiano d702fa0e1a
Add test to ensure root requirements do not get expanded by the pool builder 2020-10-13 15:14:20 +02:00
Jordi Boggiano 528030716e
Fix tests 2020-10-13 15:01:22 +02:00
Jordi Boggiano bafdf9f705
Merge branch '1.10' 2020-10-13 14:47:23 +02:00
Nicolas Grekas 893fbfcb89 Add support for "extra.branch-version" 2020-10-13 13:56:18 +02:00
Jordi Boggiano 24abd233ec
Merge branch 'master' into code-improvements 2020-10-13 12:23:13 +02:00
Jordi Boggiano 0775e261c5
Merge remote-tracking branch 'lstrojny/apcu-prefix' 2020-10-13 10:19:30 +02:00
Jordi Boggiano 09ef026d43
Remove OperationInterface::getReason, closes #9230, closes #9263 2020-10-12 12:31:54 +02:00
Jordi Boggiano 03b8c3db3f
Merge branch '1.10' 2020-10-08 14:38:41 +02:00
Jordi Boggiano 6698e0bafa
Merge remote-tracking branch 'naderman/version-guess-remotes' into 1.10 2020-10-08 14:01:25 +02:00
Nicolas Grekas f9913205dd Fix VcsRepositoryTest 2020-10-08 11:06:39 +02:00
Nils Adermann 89afb823b6 VersionGuesser: Add test for remote version guess 2020-10-07 15:21:04 +02:00
Nils Adermann 92722a9a4c VersionGuesser: Fix root package loader test which relies on git cmd in guesser 2020-10-07 15:11:08 +02:00
Nils Adermann db2f09a361 VersionGuesser: Update tests to match new git command generated 2020-10-07 14:25:55 +02:00
Simon Berger 80d71ccb3f Merged isset, unset and str_replace calls 2020-09-26 00:55:19 +02:00
Michael Telgmann a4509d28e7
Introduce constants for Composer\Package\Link types 2020-09-21 14:22:06 +02:00
Simon Berger 80a75e9959 Minor code improvements 2020-09-20 02:16:28 +02:00
Lars Strojny 0b6abf3b96
APCu prefix as a separate option 2020-09-16 10:49:00 +02:00
Lars Strojny de0085767c
Sanitize prefix 2020-09-15 12:39:22 +02:00
Lars Strojny dafd225a35
Allow to pass a string for apcu-autoloader to set the APCu prefix 2020-09-14 22:36:53 +02:00
Jordi Boggiano d942c65e0c
Fix more warnings 2020-09-11 11:32:09 +02:00
Jordi Boggiano 1593b67230
Fix warnings on higher phpunit versions 2020-09-11 11:01:32 +02:00
Simon Berger f3936b82cd Added test to cancel ProcessExecutor::asyncExecute 2020-09-08 11:33:41 +02:00
Nils Adermann 976fcd2eb4 PoolBuilderTest: Add case for multiple repositories and partial update with replace 2020-09-01 12:07:12 +02:00
Nils Adermann 6c4ed247dd Add a pool builder test for replaces across multiple repos 2020-08-31 16:00:49 +02:00
Nils Adermann 1385412748 Merge branch 'master' into filter-packages
* master:
  Add tests for edge cases of packages providing names which exist as real packages
  Add another test verifying that a package may provide an incompatible version of sth that actually exists
  Fix provider coexistence test, needs another requirement to install both
  Fix test filename to end with .test extension so it gets run
  Update config section to note required scope for GitLab tokens
  Fix pre/post-package-install/update/uninstall events receiving a partial list of operations, fixes #9079
  Also remove credentials from cache dirs in git/svn drivers, fixes #7439, refs #9155
  AuthHelper: Allow fall-through GitLab-specific HTTP headers for auth
  Sanitize repo URLs to mask HTTP auth passwords from cache directory
  Util/Zip: fix strpos args order
2020-08-28 14:52:58 +02:00
Nils Adermann 43093d0eeb Add tests for edge cases of packages providing names which exist as real packages 2020-08-28 14:50:28 +02:00
Nils Adermann 140665eadd Add another test verifying that a package may provide an incompatible version of sth that actually exists 2020-08-28 13:40:44 +02:00
Nils Adermann 85950f8e9a Fix provider coexistence test, needs another requirement to install both 2020-08-28 13:40:44 +02:00
Nils Adermann cf8ff2a75d Fix test filename to end with .test extension so it gets run 2020-08-28 13:40:44 +02:00
Nils Adermann c9201b8e40 PoolBuilderTest: Allow setting filter options for repositories 2020-08-28 13:07:11 +02:00
Nils Adermann fcb9ef4899 Allow defining multiple reppos in pool builder tests 2020-08-28 12:15:19 +02:00
Ayesh Karunaratne 931a1ff1f8
AuthHelper: Allow fall-through GitLab-specific HTTP headers for auth
Previously, `AuthHelper` consumed the authentication credentials for GitLab domains and added access tokens as GitLab-specific headers.
[Composer repositories now supported in GitLab](https://php.watch/articles/composer-gitlab-repositories) require standard Authorization headers with a personal access to function, which failed to work due to out GitLab-specific headers.

With this commit, AuthHelper checks if the password is an access token, and falls through to HTTP basic authentication even if the domain name is a GitLab domain name.
2020-08-27 12:13:28 +07:00
Jordi Boggiano 9a04ecefbf
Merge branch 'master' into filter-packages 2020-08-25 16:51:28 +02:00
Jordi Boggiano 6186c7f36f
Fix handling of root aliases in partial updates, fixes #9110 2020-08-25 11:05:28 +02:00
Jordi Boggiano 448daea696
Add support for detecting packages not matching only due to minimum stability 2020-08-23 16:48:07 +02:00
Jordi Boggiano 4d83783641
Fix test to avoid network usage 2020-08-23 16:03:00 +02:00
Oleg Andreyev e745e59656
updated repositories-priorities4.test 2020-08-22 20:11:15 +03:00
Oleg Andreyev f262feebec
fixing error message for higher repository priority, when higher repo has only a dev-branch 2020-08-22 20:07:13 +03:00
Lars Strojny 3e750b69f4
Fix name 2020-08-18 16:31:46 +02:00
Lars Strojny a83588f568
The proper fix 2020-08-18 16:30:47 +02:00
Lars Strojny 99fd5c7b49
Add tests 2020-08-18 16:05:40 +02:00
Jordi Boggiano 4d20e6f5d6
Move Version util to Platform namespace, fix CS nitpicks, make regexes case insensitive for robustness, refs #9093 2020-08-13 15:48:41 +02:00
Jordi Boggiano 7e1ef19a5a
Expand library version checking capabilities (closes #9093) 2020-08-13 15:48:41 +02:00
Wissem Riahi 657ae5519e
Add support for TAR in Artifact packages (#9105) 2020-08-12 20:30:58 +02:00
Jordi Boggiano 00f712a7c4
Revert "Allow specifying a version requirement for CLDR" 2020-07-30 21:00:43 +02:00
Jordi Boggiano 7bcde1481d
Fix git downloader syntax for windows cmd when updating packages, fixes #9089 2020-07-30 14:38:48 +02:00
Lars Strojny 5a02ea6a96
Check that class exists 2020-07-30 14:29:48 +02:00
Lars Strojny 404dea61c2
Allow specifying a version requirement for the relevant CLDR 2020-07-29 19:32:53 +02:00
Jordi Boggiano d8fa746433
Merge pull request #9058 from Seldaek/zip-cleanup
Clean up Zip Util to be more strict about what is a valid package archive
2020-07-21 17:17:12 +02:00
Wissem Riahi c353ac835c
Add exception for multiple composer.json files (#3) 2020-07-21 17:10:26 +02:00
Jordi Boggiano 22367a68f9
Avoid loading same packages multiple times 2020-07-17 16:16:58 +02:00
Jordi Boggiano 23339e44b8
Fix alias tests to use default-branches 2020-07-17 16:15:19 +02:00
Yanick Witschi 6ba0f3adf9 Merge branch 'master' into filter-packages
* master: (59 commits)
  Update deps
  Reuse repository manager and others directly from the Composer instance, refs #9057
  Fix usage of create-project with local filesystem repos
  Fix return value
  Add support for multiple --repository additions in create-project, and make --add-repository delete the lock file, fixes #8853
  Remove cygwin php handling in UAC elevation
  Clean up a little to make impl less invasive and to handle replacers/providers
  Supply event dispatcher in Create Project Command
  Avoid attempting to use /etc/xdg as base config home, fixes #9053, refs #9045
  Create an issue @ Docker repository on tag
  Mark transaction classes internal, refs #8827
  Prepare 1.10.9 release
  Remove highest/lowest builds for 1.10 maintenance branch
  Fix bitbucket detection of redirects to login page, fixes #9041
  Fix doc comment
  Fixed spelling mistake
  Add Windows UAC elevation to self-update command
  GitLab: clarify interactive auth prompt
  Improve support for XDG and default to XDG config dir if both that and ~/.composer are available, fixes #9045
  Fix #9033 - inconsistent behavior with minor-only flag
  ...
2020-07-17 14:30:12 +02:00
Jordi Boggiano 433968de17
Fix usage of create-project with local filesystem repos 2020-07-17 11:30:03 +02:00
Jordi Boggiano 942562c382
Clean up Zip Util to be more strict about what is a valid package archive, fixes #8931 2020-07-16 17:36:46 +02:00
Jordi Boggiano 212fbc516e
Fix test issues 2020-07-02 08:12:25 +02:00
Nils Adermann 3d2d33dd58 Solver: Add missing rules and replace some with %A for pcre length limit 2020-06-26 22:11:13 +02:00
Nils Adermann de3931c742 Revert "Remove unnecessary duplicate rule output from expected test result"
This reverts commit c78eb49b5e.
2020-06-26 22:03:18 +02:00
Nils Adermann c78eb49b5e Remove unnecessary duplicate rule output from expected test result 2020-06-26 21:51:02 +02:00
Nils Adermann 2cfb60e683 Solver: Add test case for github issue 7051 2020-06-26 21:51:02 +02:00
Jordi Boggiano bee91155a1
Fix guessing of default branch when HEAD is a non-feature-branch 2020-06-26 16:16:16 +02:00
Jordi Boggiano 05dacbdabb
Rename DEV_MASTER_ALIAS to DEFAULT_BRANCH_ALIAS 2020-06-25 08:56:14 +02:00
Jordi Boggiano 74d89d7110
Get rid of default branch handling in version guesser as it is way too time intensive at every initialization 2020-06-24 21:16:16 +02:00
Yanick Witschi ea0ce9dd7d Merge branch 'master' into filter-packages 2020-06-22 18:38:16 +02:00
Jordi Boggiano 6d2b5c1950
Add missing class 2020-06-19 17:58:21 +02:00
Jordi Boggiano 7a37e78a30
Speed up installer tests by avoiding lots of bootstrapping and git processes 2020-06-19 17:56:13 +02:00
Jordi Boggiano d19f5db568
Fix tests to use default-branch prop 2020-06-19 16:06:38 +02:00
Jordi Boggiano 6349764c2d
Fix root package handling of default-branch 2020-06-19 15:34:28 +02:00
Jordi Boggiano 6f0e5996de
Treat default branch name as a non-feature-branch no matter what it is called 2020-06-19 14:12:44 +02:00
Jordi Boggiano f70d527f4f
Fix git tests 2020-06-17 17:53:00 +02:00
Jordi Boggiano 04381c70fe
Merge branch '1.10' 2020-06-17 17:37:39 +02:00
Jordi Boggiano fb7fc4a4ca
Fix git tests 2020-06-17 16:59:43 +02:00
Jordi Boggiano 93d4cf6f91
Add --no-show-signature where git supports it, fixes #8966 2020-06-17 16:37:06 +02:00
Jordi Boggiano 83c64a9d19
Reuse operation formatting logic in downloaders 2020-06-17 12:33:02 +02:00
Jordi Boggiano e5fe35d554
Update test description 2020-06-17 09:24:25 +02:00
Jordi Boggiano c8731598cc
Merge branch '1.10' 2020-06-16 17:16:42 +02:00
Jordi Boggiano ee58f25c00
Fix ZipDownloaderTest 2020-06-16 14:00:25 +02:00
Jordi Boggiano 3af617efe8
Parallelize zip extraction using async unzip processes 2020-06-16 14:00:20 +02:00
Jordi Boggiano 0dad963cd8
Add executeAsync to ProcessExecutor and allow Loop class to wait on it in addition to HttpDownloader 2020-06-16 14:00:19 +02:00
Jordi Boggiano a797ee1322
Fix inline aliases not being loaded when extracting dev requirements, fixes #8954 2020-06-16 13:50:29 +02:00
Michael Chekin 6d9bf42655
Additional Util\RemoteFileSystem tests (#8960)
* RemoteFilesystemTest: simplifying some mock expectations calls

- will($this->returnValue()) to willReturn()
- will($this->returnCallBack()) to willReturnCallback()

* RemoteFilesystemTest: extracting identical mocks for IOInterface into a separate getIOInterfaceMock() method

* RemoteFilesystemTest: converting protected helper methods to private.

* RemoteFilesystemTest: moving getConfigMock() private method after the public methods (with other private methods)

* adding RemoteFileSystemTest::testCopyWithRetryAuthFailureFalse() unit test.

* Allow optional injecting of AuthHelper into RemoteFilesystem constructor.

* adding RemoteFileSystemTest::testCopyWithSuccessOnRetry() unit test.

* using backward compatible @expectedException in RemoteFilesystemTest.php

* RemoteFilesystemTest: extracting RemoteFilesystem with mocked method creation into a separate method.

* RemoteFilesystemTest: extracting AuthHelper with mocked method creation into a separate method.
2020-06-16 09:35:33 +02:00
Graham Campbell fa799970ad Replace whitelist with allow list 2020-06-07 22:15:09 +01:00
Jordi Boggiano 2fa58ccf96
Reduce amount of packages loaded by avoiding extensions of the constraint beyond the root constraint 2020-06-06 17:18:42 +02:00
Jordi Boggiano 4b9b499ce5
Fix issue loading aliases and fix markPackageNameForLoading when called twice in a row for same package it would overwrite the constraint the second time 2020-06-06 17:16:54 +02:00
Jordi Boggiano b7f1550896
Add test covering replacer unfixing 2020-06-06 15:20:14 +02:00
Jordi Boggiano f2befc46c9
Avoid storing duplicate packages when loading the same package twice 2020-06-05 17:13:39 +02:00
Jordi Boggiano 67a88880ec
Get rid of EmptyConstraint 2020-06-05 16:52:24 +02:00
Yanick Witschi c7f10bdd90
Fixed RuleTest 2020-06-05 16:52:24 +02:00
Yanick Witschi bde9502473
Made the constraint argument in Link mandatory 2020-06-05 16:52:24 +02:00
Yanick Witschi 63906171f0
Cleanup EmptyConstraint output 2020-06-05 16:52:24 +02:00
Yanick Witschi b935a76bc6
Removed already covered test 2020-06-05 16:52:24 +02:00
Yanick Witschi 8b4e834675
Added another poolbuilder test to show issue with constraint matching 2020-06-05 16:52:24 +02:00
Yanick Witschi 71fde80048
Fixed test 2020-06-05 16:52:24 +02:00
Yanick Witschi 29611a4d27
Fixed test descriptions 2020-06-05 16:52:24 +02:00
Yanick Witschi 8e2dd62d10
Fixed tests related to constraint changes 2020-06-05 16:52:24 +02:00
Yanick Witschi bca88bdd4b
Fixed PoolBuilder running endlessly when packages do not exist 2020-06-05 16:52:24 +02:00
Yanick Witschi 28f82032cd
And here's the key test :) 2020-06-05 16:52:24 +02:00
Yanick Witschi b87fc5bbfd
Added more poolbuilder test 2020-06-05 16:52:24 +02:00
Nils Adermann 43888cae8c
PoolBuilder: failing test for partial update with multiple deps 2020-06-05 16:52:24 +02:00
Nils Adermann 4f13875f3f
PoolBuilderTest: add new fixtures for partial updates with locked packages 2020-06-05 16:52:24 +02:00
Nils Adermann 85ea29d241
PoolBuilder failing test: do not load alternatives for pkg replaced by fixed pkg 2020-06-05 16:52:24 +02:00
Nils Adermann 208a735645
PoolBuilder Failing test: fixed package is not only pkg loaded for that name 2020-06-05 16:52:24 +02:00
Jordi Boggiano a4a617abb4
Reduce amount of Filesystem/ProcessExecutor instantiations, add lots of docblocks 2020-06-04 16:08:23 +02:00
Jordi Boggiano a66a939b76
Merge pull request #8937 from Seldaek/optim-rules
Optimize rule creation for alias packages
2020-06-03 14:17:13 +02:00
Jordi Boggiano fafa959933
Add test to assert prefer-lowest behavior when conflicting branches prevent absolute lowest version from being installed, closes #7408 2020-06-03 08:34:25 +02:00
Jordi Boggiano 5a4709c3d6
Optimize rule creation for alias packages
This mainly benefits projects running updates with minimum-stability: dev
2020-06-02 13:44:56 +02:00
Jordi Boggiano 1ea3111583
Use RULE_LEARNED instead of RULE_FIXED 2020-06-02 13:21:05 +02:00
Jordi Boggiano 5e5f9f8142
Remove unused RULE_INTERNAL_ALLOW_UPDATE 2020-06-02 11:22:35 +02:00
Jordi Boggiano c8efb50d39
Change the single requirement ignore from --ignore-platform-reqs=xx to --ignore-platform-req=xx to avoid BC issues 2020-06-02 11:22:09 +02:00
Jordi Boggiano 2ddf4346ef
Improve error reporting for RULE_PACKAGE_ALIAS 2020-06-02 10:35:04 +02:00
Jordi Boggiano 0ea9eafcaf
Add rules for aliased packages when an alias is added, fixes #8902 2020-06-02 10:07:20 +02:00
Jordi Boggiano dfccf8c091
Add failing test reproducing the problem of #8902 2020-06-02 10:00:09 +02:00
Jordi Boggiano 537402f814
Add tests for #8861 2020-06-01 16:01:43 +02:00
Jordi Boggiano e85da00dff
Add a way to ignore only some packages in --ignore-platform-reqs, and make the platform check ignore those packages which were ignored as requirements, fixes #8861 2020-06-01 15:43:24 +02:00
Jordi Boggiano 21e708f2c4
Remove upper bound PHP version checks from platform-check as there is not enough value added and it risks causing issues 2020-06-01 09:39:44 +02:00
Jordi Boggiano b72ac2d01a
Oops 2020-05-26 19:55:40 +02:00
Jordi Boggiano 863e7076ba
Bump to use composer/semver 3.x 2020-05-26 19:18:34 +02:00
Jordi Boggiano d72a07db06
Fix tests 2020-05-22 13:28:47 +02:00
Jordi Boggiano 4e1f8cf89d
Build tweaks 2020-05-20 16:20:54 +02:00
Jordi Boggiano 45d3e133a4
Avoid checking for unbounded constraints in platform checks 2020-05-19 17:15:08 +02:00
Jordi Boggiano 98e5f81a5f
Fix detection of fixed package problems to include more cases, fixes #8910 2020-05-19 12:17:25 +02:00
Jordi Boggiano 22622372bc
Fix complete test suite for v2 2020-05-06 13:23:52 +02:00
Jordi Boggiano f73c8c419c
Merge pull request #8869 from naderman/replace-semver-test
Adding a test to verify replace version overlap with unbound constraints and single versions
2020-05-06 10:53:45 +02:00
Jordi Boggiano dd0c8b4278
Merge pull request #8723 from helhum/fix-package-sorting
Fix package sorting
2020-05-06 10:47:01 +02:00
Nils Adermann ff0717ad66
Merge pull request #8859 from Seldaek/deduplicate-problems
Deduplicate require/conflict rules which are the same but for different versions of the same package
2020-05-05 16:19:07 +02:00
Jordi Boggiano 419567ba6d
Update VersionSelector to take all platform requirements into account when selecting packages 2020-05-04 21:16:41 +02:00
Nils Adermann d15447c454 Add test for replace version overlap 2020-05-04 11:24:11 +02:00
Michael Chekin c23670c3ec
Add Util\AuthHelper unit test coverage (#8863)
* Add AuthHelper::addAuthenticationHeader() test on missing authentication credentials.

* Add AuthHelper::addAuthenticationHeader() test on bearer password.

* Add AuthHelper::addAuthenticationHeader() test on Github token.

* Add AuthHelper::addAuthenticationHeader() test on Gitlab Oauth token.

* Add $authenticationDisplayMessage write expectation to AuthHelper::addAuthenticationHeader() tests.

* Add AuthHelper::addAuthenticationHeader() test on Gitlab private token.

* Add AuthHelper::addAuthenticationHeader() test on Bitbucket Oauth token.

* Add AuthHelper::addAuthenticationHeader() test on Bitbucket public urls.

* Add AuthHelper::addAuthenticationHeader() test on Basic Http Authentication.

* Add AuthHelper::isPublicBitBucketDownload() tests.

* Rename AuthHelperTest $credentials variable to $auth.

* Add AuthHelper::storeAuth() test for auto-store option.

* Add AuthHelper::storeAuth() test for user prompt and y(es) answer.

* Add AuthHelper::storeAuth() test for user prompt and n(o) answer.

* Add AuthHelper::storeAuth() test for user prompt with invalid answer.

* Add AuthHelper::promptAuthIfNeeded() test for Github authentication failure.

- add GitHub hard dependency mock (new GitHub(...) mock)

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP > 5.3

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP >= 5.4

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP 5.4

* Exclude PHPStan analyses of '../tests/Composer/Test/Util/Mocks/*'

* Exclude AuthHelper::promptAuthIfNeeded() tests from current pull request.

* Extract repetitive AuthHelperTest authentication expectation into a method.
2020-05-04 09:48:23 +02:00
Helmut Hummel 7c891701e6 Fix package sorting
PackageSorter weighs the importance of a package
by counting how many times it is required by other packages.
This works by calculating the weight for each package name.

However currently the package index of the package array
is currently passed the weigh function, which basically
disables package sorting.

The reason for that is, that a package repository previously
returned the package list as associative array with  package name as keys,
but currently just as an array with integer keys.

Therefore we must extract the package name from the package
before passing it to the weigh function.
2020-05-03 16:31:47 +02:00
Jordi Boggiano 3a64acb53e
Make sure versions are ordered also in the satisfied by package lists 2020-05-01 15:54:01 +02:00
Jordi Boggiano 56a11b9c2c
Deduplicate require/conflict rules which are the same but for different versions of the same package, fixes #8851 2020-05-01 15:41:54 +02:00
Jordi Boggiano 74a63b4d6b
Merge branch '1.10' 2020-04-30 21:31:29 +02:00
Alessandro Lai 270c7c3262
Backport validation support for composer-runtime-api (#8842)
Fixes #8841
2020-04-28 16:04:00 +02:00
Michael Chekin b9be78b689
Additional Util\Bitbucket class test coverage (#8835) 2020-04-28 11:45:30 +02:00
Jordi Boggiano 6a6ea6057f
Handle provider/replacer packages and avoid checking extensions which are provided by packages, refs #8546 2020-04-24 13:38:50 +02:00
Jordi Boggiano d494df61ff
Make sure platform-check returns a non-0 exit code if it fails 2020-04-24 13:25:13 +02:00
Jordi Boggiano d89342dc43
Fix tests 2020-04-24 09:07:32 +02:00
Jordi Boggiano df0cada93f
Add test for #8669 2020-04-23 15:11:21 +02:00
Jordi Boggiano 34801239f1
Tweak problem wording slightly 2020-04-23 13:17:34 +02:00
Jordi Boggiano 8a1e9744a0
Fix tests 2020-04-23 10:29:22 +02:00
Jordi Boggiano 7049bbb714
Switch require_once to require for autoload_static as the once variant seems unnecessary 2020-04-22 17:05:37 +02:00