Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

fixes #28 #30

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,17 +41,27 @@ 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
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:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
76 changes: 14 additions & 62 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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#'
9 changes: 6 additions & 3 deletions tests/Automatic/AutomaticTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')
Expand Down
9 changes: 6 additions & 3 deletions tests/Automatic/Prefetcher/ParallelDownloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
16 changes: 13 additions & 3 deletions tests/Automatic/Traits/ArrangeComposerClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
}