Skip to content

Commit 1368f91

Browse files
authored
Merge pull request #21 from redthor/improvement/travis-build
Trial updated travis config from bundle
2 parents 5aa287a + 80ed18e commit 1368f91

File tree

4 files changed

+52
-25
lines changed

4 files changed

+52
-25
lines changed

.travis.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1-
sudo: false
21
language: php
2+
sudo: false
33

4-
php:
5-
- 5.6
6-
7-
env:
8-
- MONGO_VERSION=stable
4+
cache:
5+
directories:
6+
- $HOME/.composer/cache/files
97

108
matrix:
119
include:
10+
# Test the latest
11+
- php: 5.6
12+
env: MONGO_VERSION=stable
1213
- php: 7.1
1314
env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable
15+
- php: 7.2
16+
env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable
1417

15-
services: mongodb
18+
# Test with the lowest deps
19+
- php: 5.6
20+
env: MONGO_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"
21+
- php: 7.2
22+
# Note that the ADAPTER_VERSION is pinned to 1.0.0 when testing lowest deps
23+
env: ADAPTER_VERSION="1.0.0" MONGODB_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"
1624

1725
before_script:
18-
- if [ "x${MONGO_VERSION}" != "x" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
19-
- if [ "x${MONGODB_VERSION}" != "x" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
20-
- if [ "x${ADAPTER_VERSION}" != "x" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
26+
# Not using code coverage
27+
- phpenv config-rm xdebug.ini
28+
- if ! [ -z "$MONGO_VERSION" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
29+
- if ! [ -z "$MONGODB_VERSION" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
30+
- if ! [ -z "$ADAPTER_VERSION" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
2131
- composer self-update
22-
- composer install --dev
32+
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
33+
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --ignore-platform-reqs --quiet; fi
34+
- composer update -v ${COMPOSER_FLAGS}
2335

2436
script:
2537
- ./vendor/bin/phpunit

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"require-dev": {
2222
"antimattr/test-case": "~1.0@stable",
2323
"phpunit/phpunit": "^5.0",
24+
"phpunit/phpunit-mock-objects": ">=3.0.4",
25+
"sebastian/version": ">=1.0.3",
26+
"sebastian/comparator": ">=1.2.3",
2427
"friendsofphp/php-cs-fixer": "^2.0",
2528
"mikey179/vfsStream": "1.*"
2629
},

tests/AntiMattr/Tests/MongoDB/Migrations/OutputWriterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class OutputWriterTest extends AntiMattrTestCase
1111

1212
protected function setUp()
1313
{
14-
$this->output = $this->createMock('Symfony\Component\Console\Output\OutputInterface');
14+
$this->output = $this->buildMock('Symfony\Component\Console\Output\OutputInterface');
1515
$output = $this->output;
1616
$this->outputWriter = new OutputWriter(function ($message) use ($output) {
1717
return $output->writeln($message);

tests/AntiMattr/Tests/MongoDB/Migrations/Tools/Console/Command/StatusCommandTest.php

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,14 @@ public function testExecuteWithShowingVersions()
314314
)
315315
)
316316
;
317+
317318
$this->output->expects($this->at(0))
318319
->method('writeln')
319320
->with(
320321
"\n <info>==</info> Configuration\n"
321322
)
322323
;
324+
323325
$this->output->expects($this->at(1))
324326
->method('writeln')
325327
->with(
@@ -330,6 +332,7 @@ public function testExecuteWithShowingVersions()
330332
)
331333
)
332334
;
335+
333336
$this->output->expects($this->at(2))
334337
->method('writeln')
335338
->with(
@@ -340,6 +343,7 @@ public function testExecuteWithShowingVersions()
340343
)
341344
)
342345
;
346+
343347
$this->output->expects($this->at(3))
344348
->method('writeln')
345349
->with(
@@ -441,20 +445,28 @@ public function testExecuteWithShowingVersions()
441445
->with("\n <info>==</info> Available Migration Versions\n")
442446
;
443447

444-
$this->output->expects($this->at(39))
445-
->method('writeln')
446-
->with("\n <info>==</info> Previously Executed Unavailable Migration Versions\n")
447-
;
448-
$this->output->expects($this->at(40))
449-
->method('writeln')
450-
->with(
451-
sprintf(
452-
' <comment>>></comment> %s (<comment>%s</comment>)',
453-
\DateTime::createFromFormat('YmdHis', $unavailableMigratedVersion)->format('Y-m-d H:i:s'),
454-
$unavailableMigratedVersion
448+
$isLowest = false;
449+
if (class_exists('\PHPUnit_Runner_Version')) {
450+
$isLowest = '5.0.0' === \PHPUnit_Runner_Version::id();
451+
}
452+
453+
if (!$isLowest) {
454+
$this->output->expects($this->at(39))
455+
->method('writeln')
456+
->with("\n <info>==</info> Previously Executed Unavailable Migration Versions\n")
457+
;
458+
459+
$this->output->expects($this->at(40))
460+
->method('writeln')
461+
->with(
462+
sprintf(
463+
' <comment>>></comment> %s (<comment>%s</comment>)',
464+
\DateTime::createFromFormat('YmdHis', $unavailableMigratedVersion)->format('Y-m-d H:i:s'),
465+
$unavailableMigratedVersion
466+
)
455467
)
456-
)
457-
;
468+
;
469+
}
458470

459471
// Run command, run.
460472
$this->command->run(

0 commit comments

Comments
 (0)