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

Commit

Permalink
fixes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Aug 3, 2018
1 parent d6f5122 commit 9092214
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 74 deletions.
20 changes: 18 additions & 2 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,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
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.

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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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);
}
}
}

0 comments on commit 9092214

Please sign in to comment.