42 Commits (3d0b46c8b0a39639c4ddb1b70a5fc27b6da6fe3d)

Author SHA1 Message Date
Jordi Boggiano 6a466a120a
Enable strict types on all files 2 years ago
Jordi Boggiano 3cdca37e85
Fix strict type issues 2 years ago
Jordi Boggiano 6da38f83a0
Add parameter types to all the things 2 years ago
Jordi Boggiano a16ed3d0ed
Add return types to private/internal methods 2 years ago
Jordi Boggiano abdc6893a6
Add void types where no return statement is present 2 years ago
Jordi Boggiano 5805a68645
Fix some todos dropping support for older Symfony releases 3 years ago
Jordi Boggiano ccd87c479c
Test fixes 3 years ago
Jordi Boggiano ffd62795bc
Get rid of all the ->at() mock invocations 3 years ago
Jordi Boggiano 2a771dfb2d
Update PHPUnit to 8.5 3 years ago
Jordi Boggiano 24ce1eddbd
Add composer/pcre dependency and use it everywhere instead of preg_* 3 years ago
Jordi Boggiano cb0293cf30
Finalize phpstan level 6 for tests dir, closes #10159 3 years ago
Jordi Boggiano 97fe881af4
Add some docblocks 3 years ago
Jordi Boggiano d3c176ec69
PHPStan Level 5 (#10070)
* Bump PHPStan to level 5

* Update seld/phar-utils to latest

* Add phpstan-setup / phpstan scripts
3 years ago
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>
3 years ago
Jordi Boggiano d0b399b788
Merge branch '2.0' 3 years ago
Jordi Boggiano 0879e80d56
Fix functional tests to use the same PHP version as PHPUnit runs with 3 years ago
Jordi Boggiano 40800df6bd
Fix CS 3 years ago
Jordi Boggiano a54d16f8a6
Fix tests env usage 3 years ago
Jordi Boggiano 7267533690
Add one more InstalledVersions test for upgrades showing a known issue with plugin upgrades 3 years ago
Jordi Boggiano d3ba447b79
Full functional test-bed improvements 3 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Jordi Boggiano 433968de17
Fix usage of create-project with local filesystem repos 4 years ago
Gabriel Caruso b4fc3b7eef
Make usage of foreach to improve readability
Instead of count and comparing, we can simple use a foreach.
5 years ago
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
6 years ago
Gabriel Caruso a4b220273e Refactoring Tests (#6849) 7 years ago
Jordi Boggiano 122e422682 CS fixes 7 years ago
Jad Bitar 8625efd551 Fix support for testing exit code
The `$sectionData` was being overwritten, causing its assertion 
(`$this->assertSame()`) to fail.
8 years ago
Rob Bast adf3b956d0 try to use unique test directories
any tests that use the filesystem should have their own unique directory, as we run our test suite in parallel and
cleanup of tests (removing directories) should not interfere with currently running tests
9 years ago
Jordi Boggiano 414cf70008 Fix phar build test 9 years ago
Jordi Boggiano b80038804f Fix env override regression, fixes #3820 9 years ago
Rob Bast 85955d82a6 Raise timeout to 5 minutes 9 years ago
Jordi Boggiano fc3c7838b2 CS fixes 10 years ago
Christophe Coevoet ea44412476 Skip the phar building on HHVM
Building a phar does not work on HHVM. It looks like it tries to read the phar file which does not exist yet.
10 years ago
Jordi Boggiano ac497feaba CS fixes 10 years ago
Jordi Boggiano 1dd8bffce5 CS fixes 11 years ago
Nils Adermann 4af69c85ca Fix tests by passing proper working directory to processes 11 years ago
Jordi Boggiano cfc8bf0730 Make phar build fails more debuggable 11 years ago
Jordi Boggiano 5f3814bd05 Add test building phar and run functional tests with the phar, refs #1155 12 years ago
Jordi Boggiano 62d0ea7656 Circumvent cache in functional tests 12 years ago
Jordi Boggiano 487e66d0a9 Allow loading of multiple composer autoloaders concurrently, fixes #1248 12 years ago
Jordi Boggiano 6d38709fe8 Fix create project test 12 years ago
Jordi Boggiano 5b419c76ca Fix tests 12 years ago