diff --git a/.travis.yml b/.travis.yml
index af481bf..c56974a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,37 @@
-sudo: false
language: php
+sudo: false
-php:
- - 5.6
-
-env:
- - MONGO_VERSION=stable
+cache:
+ directories:
+ - $HOME/.composer/cache/files
matrix:
include:
+ # Test the latest
+ - php: 5.6
+ env: MONGO_VERSION=stable
- php: 7.1
env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable
+ - php: 7.2
+ env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable
-services: mongodb
+ # Test with the lowest deps
+ - php: 5.6
+ env: MONGO_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"
+ - php: 7.2
+ # Note that the ADAPTER_VERSION is pinned to 1.0.0 when testing lowest deps
+ env: ADAPTER_VERSION="1.0.0" MONGODB_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"
before_script:
- - if [ "x${MONGO_VERSION}" != "x" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
- - if [ "x${MONGODB_VERSION}" != "x" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
- - if [ "x${ADAPTER_VERSION}" != "x" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
+ # Not using code coverage
+ - phpenv config-rm xdebug.ini
+ - if ! [ -z "$MONGO_VERSION" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
+ - if ! [ -z "$MONGODB_VERSION" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
+ - if ! [ -z "$ADAPTER_VERSION" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
- composer self-update
- - composer install --dev
+ # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
+ - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --ignore-platform-reqs --quiet; fi
+ - composer update -v ${COMPOSER_FLAGS}
script:
- ./vendor/bin/phpunit
diff --git a/composer.json b/composer.json
index 4c24610..2af7778 100644
--- a/composer.json
+++ b/composer.json
@@ -21,6 +21,9 @@
"require-dev": {
"antimattr/test-case": "~1.0@stable",
"phpunit/phpunit": "^5.0",
+ "phpunit/phpunit-mock-objects": ">=3.0.4",
+ "sebastian/version": ">=1.0.3",
+ "sebastian/comparator": ">=1.2.3",
"friendsofphp/php-cs-fixer": "^2.0",
"mikey179/vfsStream": "1.*"
},
diff --git a/tests/AntiMattr/Tests/MongoDB/Migrations/OutputWriterTest.php b/tests/AntiMattr/Tests/MongoDB/Migrations/OutputWriterTest.php
index bf26509..cb6e39b 100644
--- a/tests/AntiMattr/Tests/MongoDB/Migrations/OutputWriterTest.php
+++ b/tests/AntiMattr/Tests/MongoDB/Migrations/OutputWriterTest.php
@@ -11,7 +11,7 @@ class OutputWriterTest extends AntiMattrTestCase
protected function setUp()
{
- $this->output = $this->createMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->output = $this->buildMock('Symfony\Component\Console\Output\OutputInterface');
$output = $this->output;
$this->outputWriter = new OutputWriter(function ($message) use ($output) {
return $output->writeln($message);
diff --git a/tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command/StatusCommandTest.php b/tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command/StatusCommandTest.php
index bdad82e..c7ad4f2 100644
--- a/tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command/StatusCommandTest.php
+++ b/tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command/StatusCommandTest.php
@@ -314,12 +314,14 @@ public function testExecuteWithShowingVersions()
)
)
;
+
$this->output->expects($this->at(0))
->method('writeln')
->with(
"\n == Configuration\n"
)
;
+
$this->output->expects($this->at(1))
->method('writeln')
->with(
@@ -330,6 +332,7 @@ public function testExecuteWithShowingVersions()
)
)
;
+
$this->output->expects($this->at(2))
->method('writeln')
->with(
@@ -340,6 +343,7 @@ public function testExecuteWithShowingVersions()
)
)
;
+
$this->output->expects($this->at(3))
->method('writeln')
->with(
@@ -441,20 +445,28 @@ public function testExecuteWithShowingVersions()
->with("\n == Available Migration Versions\n")
;
- $this->output->expects($this->at(39))
- ->method('writeln')
- ->with("\n == Previously Executed Unavailable Migration Versions\n")
- ;
- $this->output->expects($this->at(40))
- ->method('writeln')
- ->with(
- sprintf(
- ' >> %s (%s)',
- \DateTime::createFromFormat('YmdHis', $unavailableMigratedVersion)->format('Y-m-d H:i:s'),
- $unavailableMigratedVersion
+ $isLowest = false;
+ if (class_exists('\PHPUnit_Runner_Version')) {
+ $isLowest = '5.0.0' === \PHPUnit_Runner_Version::id();
+ }
+
+ if (!$isLowest) {
+ $this->output->expects($this->at(39))
+ ->method('writeln')
+ ->with("\n == Previously Executed Unavailable Migration Versions\n")
+ ;
+
+ $this->output->expects($this->at(40))
+ ->method('writeln')
+ ->with(
+ sprintf(
+ ' >> %s (%s)',
+ \DateTime::createFromFormat('YmdHis', $unavailableMigratedVersion)->format('Y-m-d H:i:s'),
+ $unavailableMigratedVersion
+ )
)
- )
- ;
+ ;
+ }
// Run command, run.
$this->command->run(