From 90922140425bcf6091271dcc5ac7445c33f5dcfd Mon Sep 17 00:00:00 2001 From: Daniel Bannert Date: Fri, 3 Aug 2018 19:36:43 +0200 Subject: [PATCH 1/2] fixes #28 --- .travis.yml | 20 ++++- composer.json | 2 +- composer.lock | 76 ++++--------------- tests/Automatic/AutomaticTest.php | 9 ++- .../QuestionInstallationManagerTest.php | 1 + .../Prefetcher/ParallelDownloaderTest.php | 9 ++- .../Traits/ArrangeComposerClasses.php | 16 +++- 7 files changed, 59 insertions(+), 74 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7dc650bd..b9517101 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,14 @@ before_install: install: - composer global require hirak/prestissimo - - $COMPOSER_UP + - | + if [[ "$SETUP" = "high" ]]; then + $COMPOSER_UP + elif [[ "$SETUP" = "lowest" ]]; then + $COMPOSER_UP --prefer-lowest --prefer-stable; + else + $COMPOSER_UP + fi before_script: - wget https://cdn.rawgit.com/prisis/43a2a7b137998ac92e24ee4daaa8e296/raw/681b89b8e156750de46558ead661509c468fb9a2/try_catch.sh -P ./build/travis @@ -34,10 +41,19 @@ script: - ./build/travis/script.sh jobs: + fast_finish: true + allow_failures: + - php: nightly include: - stage: Test php: 7.2 - env: PHPUNIT=true REMOVE_XDEBUG=true + env: PHPUNIT=true SETUP=high REMOVE_XDEBUG=true + - stage: Test + php: 7.2 + env: PHPUNIT=true SETUP=lowest REMOVE_XDEBUG=true + - stage: Test + php: nightly + env: PHPUNIT=true SETUP=high REMOVE_XDEBUG=true - stage: Coding standard php: 7.2 diff --git a/composer.json b/composer.json index b04ba8b8..d9b112e9 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "composer-plugin-api": "^1.0" }, "require-dev": { - "composer/composer": "^1.6.0", + "composer/composer": "^1.6.0 || ^1.7.0", "mockery/mockery": "^1.0.0", "narrowspark/coding-standard": "^1.1.0", "narrowspark/testing-helper": "^6.0.0", diff --git a/composer.lock b/composer.lock index 82c06deb..0b39234c 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "339e72430f8a5d3eaf85070e9a801127", + "content-hash": "082e3456e8b919a53459f5c775aa9a9c", "packages": [], "packages-dev": [ { @@ -65,26 +65,26 @@ }, { "name": "composer/composer", - "version": "1.6.5", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "b184a92419cc9a9c4c6a09db555a94d441cb11c9" + "reference": "39edb2f375679a4eba19e69e9c9491e302976983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/b184a92419cc9a9c4c6a09db555a94d441cb11c9", - "reference": "b184a92419cc9a9c4c6a09db555a94d441cb11c9", + "url": "https://api.github.com/repos/composer/composer/zipball/39edb2f375679a4eba19e69e9c9491e302976983", + "reference": "39edb2f375679a4eba19e69e9c9491e302976983", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", "composer/semver": "^1.0", "composer/spdx-licenses": "^1.2", + "composer/xdebug-handler": "^1.1", "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", "php": "^5.3.2 || ^7.0", "psr/log": "^1.0", - "seld/cli-prompt": "^1.0", "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.0", "symfony/console": "^2.7 || ^3.0 || ^4.0", @@ -110,7 +110,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -141,7 +141,7 @@ "dependency", "package" ], - "time": "2018-05-04T09:44:59+00:00" + "time": "2018-08-03T13:39:07+00:00" }, { "name": "composer/semver", @@ -2909,16 +2909,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.2.7", + "version": "7.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c" + "reference": "0b6b29faf95c03fd7867e866438b78d5692b6f03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e878aff7917ef66e702e03d1359b16eee254e2c", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0b6b29faf95c03fd7867e866438b78d5692b6f03", + "reference": "0b6b29faf95c03fd7867e866438b78d5692b6f03", "shasum": "" }, "require": { @@ -2963,7 +2963,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.2-dev" + "dev-master": "7.3-dev" } }, "autoload": { @@ -2989,7 +2989,7 @@ "testing", "xunit" ], - "time": "2018-07-15T05:20:50+00:00" + "time": "2018-08-03T06:02:45+00:00" }, { "name": "psr/container", @@ -3806,54 +3806,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, - { - "name": "seld/cli-prompt", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "time": "2017-03-18T11:32:45+00:00" - }, { "name": "seld/jsonlint", "version": "1.7.1", diff --git a/tests/Automatic/AutomaticTest.php b/tests/Automatic/AutomaticTest.php index 065eb184..3273d927 100644 --- a/tests/Automatic/AutomaticTest.php +++ b/tests/Automatic/AutomaticTest.php @@ -19,6 +19,7 @@ use Composer\Plugin\PluginManager; use Composer\Repository\RepositoryManager; use Composer\Repository\WritableRepositoryInterface; +use Composer\Util\RemoteFilesystem; use Narrowspark\Automatic\Automatic; use Narrowspark\Automatic\Common\Traits\GetGenericPropertyReaderTrait; use Narrowspark\Automatic\Configurator; @@ -155,9 +156,11 @@ public function testActivate(): void ->with(\Mockery::type(RepositoryManager::class)) ->once(); - $this->ioMock->shouldReceive('writeError') - ->once() - ->with('Composer >=1.7 not found, downloads will happen in sequence', true, IOInterface::DEBUG); + if (! \method_exists(RemoteFilesystem::class, 'getRemoteContents')) { + $this->ioMock->shouldReceive('writeError') + ->once() + ->with('Composer >=1.7 not found, downloads will happen in sequence', true, IOInterface::DEBUG); + } $inputMock = $this->mock(InputInterface::class); $inputMock->shouldReceive('getFirstArgument') diff --git a/tests/Automatic/Installer/QuestionInstallationManagerTest.php b/tests/Automatic/Installer/QuestionInstallationManagerTest.php index b2e74fe1..5aeaac09 100644 --- a/tests/Automatic/Installer/QuestionInstallationManagerTest.php +++ b/tests/Automatic/Installer/QuestionInstallationManagerTest.php @@ -13,6 +13,7 @@ use Composer\Repository\RepositoryManager; use Composer\Repository\WritableRepositoryInterface; use Composer\Semver\VersionParser; +use Composer\Util\RemoteFilesystem; use Mockery\MockInterface; use Narrowspark\Automatic\Common\Contract\Exception\InvalidArgumentException; use Narrowspark\Automatic\Common\Contract\Exception\RuntimeException; diff --git a/tests/Automatic/Prefetcher/ParallelDownloaderTest.php b/tests/Automatic/Prefetcher/ParallelDownloaderTest.php index ee34d0f4..ab768046 100644 --- a/tests/Automatic/Prefetcher/ParallelDownloaderTest.php +++ b/tests/Automatic/Prefetcher/ParallelDownloaderTest.php @@ -3,6 +3,7 @@ namespace Narrowspark\Automatic\Test\Prefetcher; use Composer\IO\IOInterface; +use Composer\Util\RemoteFilesystem; use Narrowspark\Automatic\Prefetcher\ParallelDownloader; use Narrowspark\Automatic\Test\Traits\ArrangeComposerClasses; use Narrowspark\TestingHelper\Phpunit\MockeryTestCase; @@ -28,9 +29,11 @@ protected function setUp(): void $this->arrangeComposerClasses(); - $this->ioMock->shouldReceive('writeError') - ->once() - ->with('Composer >=1.7 not found, downloads will happen in sequence', true, IOInterface::DEBUG); + if (! \method_exists(RemoteFilesystem::class, 'getRemoteContents')) { + $this->ioMock->shouldReceive('writeError') + ->once() + ->with('Composer >=1.7 not found, downloads will happen in sequence', true, IOInterface::DEBUG); + } $this->parallelDownloader = new ParallelDownloader($this->ioMock, $this->configMock); } diff --git a/tests/Automatic/Traits/ArrangeComposerClasses.php b/tests/Automatic/Traits/ArrangeComposerClasses.php index b262452f..b6908d51 100644 --- a/tests/Automatic/Traits/ArrangeComposerClasses.php +++ b/tests/Automatic/Traits/ArrangeComposerClasses.php @@ -5,6 +5,7 @@ use Composer\Composer; use Composer\Config; use Composer\IO\IOInterface; +use Composer\Util\RemoteFilesystem; use Narrowspark\Automatic\Lock; use Symfony\Component\Console\Input\InputInterface; @@ -55,8 +56,17 @@ protected function arrangePackagist(): void ->andReturn(false); $this->ioMock->shouldReceive('writeError') ->with('Downloading https://packagist.org/packages.json', true, IOInterface::DEBUG); - $this->ioMock->shouldReceive('writeError') - ->once() - ->with('Writing ' . $this->composerCachePath . '/repo/https---packagist.org/packages.json into cache', true, IOInterface::DEBUG); + + if (! \method_exists(RemoteFilesystem::class, 'getRemoteContents')) { + $this->ioMock->shouldReceive('writeError') + ->once() + ->with('Writing ' . $this->composerCachePath . '/repo/https---packagist.org/packages.json into cache', true, IOInterface::DEBUG); + } else { + $this->ioMock->shouldReceive('writeError') + ->with('Downloading https://repo.packagist.org/packages.json', true, IOInterface::DEBUG); + $this->ioMock->shouldReceive('writeError') + ->once() + ->with('Writing ' . $this->composerCachePath . '/repo/https---repo.packagist.org/packages.json into cache', true, IOInterface::DEBUG); + } } } From bd5c634505b8c304a3169076eac49d0adc20203a Mon Sep 17 00:00:00 2001 From: Daniel Bannert Date: Fri, 3 Aug 2018 19:43:57 +0200 Subject: [PATCH 2/2] cs and phpstan fixes --- .travis.yml | 3 ++- phpstan.neon | 1 - tests/Automatic/Installer/QuestionInstallationManagerTest.php | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9517101..11b1d0c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,8 @@ jobs: env: REMOVE_XDEBUG=true script: - ./vendor/bin/php-cs-fixer fix --verbose --diff --dry-run - - stage: Coding standard + + - stage: Static Analysis php: 7.2 env: REMOVE_XDEBUG=false script: diff --git a/phpstan.neon b/phpstan.neon index 1b94b5ce..a6959ddb 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -29,7 +29,6 @@ parameters: - '#Call to an undefined method Composer\\DependencyResolver\\Operation\\OperationInterface\:\:getTargetPackage#' - '#Call to an undefined method Composer\\Downloader\\DownloaderInterface\:\:getCacheKey#' # ParallelDownloader - - '#Call to an undefined static method Composer\\Util\\RemoteFilesystem\:\:getRemoteContents#' - '#Call to function method_exists\(\) with #' # Automatic - '#does not call parent constructor from Composer\\Repository\\ComposerRepository#' diff --git a/tests/Automatic/Installer/QuestionInstallationManagerTest.php b/tests/Automatic/Installer/QuestionInstallationManagerTest.php index 5aeaac09..b2e74fe1 100644 --- a/tests/Automatic/Installer/QuestionInstallationManagerTest.php +++ b/tests/Automatic/Installer/QuestionInstallationManagerTest.php @@ -13,7 +13,6 @@ use Composer\Repository\RepositoryManager; use Composer\Repository\WritableRepositoryInterface; use Composer\Semver\VersionParser; -use Composer\Util\RemoteFilesystem; use Mockery\MockInterface; use Narrowspark\Automatic\Common\Contract\Exception\InvalidArgumentException; use Narrowspark\Automatic\Common\Contract\Exception\RuntimeException;