Skip to content

Commit

Permalink
Updated travis config (#90)
Browse files Browse the repository at this point in the history
* Test on symfony 4

* sort packages

* Fixed tests

* Removed debug code

* Adding doctrine annotations and force new versions of PHPUnut

* typo

* Better deps

* Bugfix

* serializer-bundle does not exists =)

* cs

* Better specify versions

* Test fix on sf2.7

* minor

* cs
  • Loading branch information
Nyholm authored Jan 15, 2018
1 parent 24325ab commit 7a44f15
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 51 deletions.
88 changes: 57 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,75 @@
language: php

sudo: false
dist: trusty

php:
- 7.1
- 7.0
- 5.6
- hhvm
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/symfony-bridge/.phpunit

env:
global:
- COMPOSER_COMMAND="composer install --prefer-dist"
- TEST_COMMAND="php vendor/bin/phpunit"
- COVERAGE=false
matrix:
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.1.*
- SYMFONY_VERSION=3.2.*
global:
- TEST_COMMAND="composer test"
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
- SYMFONY_DEPRECATIONS_HELPER="weak"

branches:
except:
- /^analysis-.*$/
- /^patch-.*$/
except:
- /^analysis-.*$/

matrix:
fast_finish: true
include:
- php: 5.6
env: COMPOSER_COMMAND="composer update --prefer-lowest --prefer-stable" COVERAGE=true TEST_COMMAND="php -dzend_extension=xdebug.so vendor/bin/phpunit --coverage-clover=coverage.xml" SYMFONY_VERSION=2.7.*
fast_finish: true
include:
# Minimum supported Symfony version and latest PHP version
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"
- php: 5.6
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"

cache:
directories:
- $HOME/.composer/cache
# Test the latest stable release
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
env: COVERAGE=true TEST_COMMAND="composer test-ci"

# Test LTS versions
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^2 symfony/property-access:^2.8"
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^3"
- php: 7.2
env: DEPENDENCIES="dunglas/symfony-lock:^4"

# Latest commit to master
- php: 7.2
env: STABILITY="dev"

allow_failures:
# dev stability is allowed to fail.
- env: STABILITY="dev"

before_install:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi;
- pip install --user codecov
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
- pip install --user codecov

install:
- travis_retry ${COMPOSER_COMMAND} --no-interaction
# 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 --quiet; fi
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
- vendor/bin/simple-phpunit install

script:
- $TEST_COMMAND
- composer validate --strict --no-check-lock
- $TEST_COMMAND

after_success:
- if [[ "$COVERAGE" = true ]]; then codecov; fi
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ $COVERAGE = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
- if [[ "$COVERAGE" = true ]]; then codecov; fi

after_script:
- wget http://tnyholm.se/reporter.phar
- php reporter.phar build:upload
31 changes: 23 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,27 @@
],
"require": {
"php": "^5.6 || ^7.0",
"symfony/framework-bundle": "^2.7 || ^3.0",
"symfony/var-dumper": "^3.3",
"cache/taggable-cache": "^1.0",
"cache/session-handler": "^1.0",
"nyholm/nsa": "^1.1"
"cache/taggable-cache": "^1.0",
"nyholm/nsa": "^1.1",
"symfony/config": "^2.7 || ^3.0 || ^4.0",
"symfony/console": "^2.7 || ^3.0 || ^4.0",
"symfony/dependency-injection": "^2.7 || ^3.0 || ^4.0",
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
"symfony/http-foundation": "^2.7 || ^3.0 || ^4.0",
"symfony/http-kernel": "^2.7 || ^3.0 || ^4.0",
"symfony/var-dumper": "^2.7 || ^3.3 || ^4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.17",
"symfony/symfony": "^2.7 || ^3.0",
"cache/psr-6-doctrine-bridge": "^3.0",
"cache/array-adapter": "^1.0",
"cache/psr-6-doctrine-bridge": "^3.0",
"doctrine/annotations": "^1.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.3",
"nyholm/symfony-bundle-test": "^1.2",
"matthiasnoback/symfony-dependency-injection-test": "^1.0"
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"symfony/routing": "^2.7 || ^3.0 || ^4.0",
"symfony/serializer": "^2.7 || ^3.0 || ^4.0",
"symfony/validator": "^2.7 || ^3.0 || ^4.0"
},
"suggest": {
"cache/adapter-bundle": "To register PSR-6 compliant cache implementations as services.",
Expand All @@ -52,5 +60,12 @@
"psr-4": {
"Cache\\CacheBundle\\Tests\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/simple-phpunit",
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
},
"config": {
"sort-packages": true
}
}
18 changes: 13 additions & 5 deletions tests/Functional/BundleInitializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Cache\CacheBundle\Routing\CachingRouter;
use Cache\SessionHandler\Psr6SessionHandler;
use Nyholm\BundleTest\BaseBundleTestCase;
use Symfony\Component\HttpKernel\Kernel;

/**
* @author Tobias Nyholm <[email protected]>
Expand All @@ -33,6 +34,10 @@ protected function setUp()
parent::setUp();
$kernel = $this->createKernel();
$kernel->addConfigFile(__DIR__.'/config.yml');

if (Kernel::MAJOR_VERSION < 4) {
$kernel->addConfigFile(__DIR__.'/sf2_and_3.yml');
}
}

public function testInitBundle()
Expand All @@ -41,10 +46,13 @@ public function testInitBundle()
$container = $this->getContainer();

$this->assertTrue($container->hasParameter('cache.provider_service_ids'));
$this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.annotation'));
$this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.serializer'));
$this->assertInstanceOf(SymfonyValidatorBridge::class, $container->get('cache.service.validation'));
$this->assertInstanceOf(Psr6SessionHandler::class, $container->get('cache.service.session'));
$this->assertInstanceOf(CachingRouter::class, $container->get('cache.service.router'));

if (Kernel::MAJOR_VERSION < 4) {
$this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.annotation'));
$this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.serializer'));
$this->assertInstanceOf(SymfonyValidatorBridge::class, $container->get('cache.service.validation'));
$this->assertInstanceOf(Psr6SessionHandler::class, $container->get('cache.service.session'));
$this->assertInstanceOf(CachingRouter::class, $container->get('cache.service.router'));
}
}
}
27 changes: 27 additions & 0 deletions tests/Functional/DummyNormalizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of php-cache\cache-bundle package.
*
* (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Cache\CacheBundle\Tests\Functional;

use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class DummyNormalizer implements NormalizerInterface
{
public function normalize($object, $format = null, array $context = [])
{
return [];
}

public function supportsNormalization($data, $format = null)
{
return false;
}
}
12 changes: 5 additions & 7 deletions tests/Functional/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ services:
array_cache:
class: Cache\Adapter\PHPArray\ArrayCachePool

dummy_normalizer:
class: Cache\CacheBundle\Tests\Functional\DummyNormalizer
tags:
- { name: serializer.normalizer }

cache:
session:
enabled: true
Expand Down Expand Up @@ -29,10 +34,3 @@ cache:
service_id: 'array_cache'
use_tagging: true

framework:
annotations:
cache: 'cache.service.annotation'
serializer:
cache: 'cache.service.serializer'
validation:
cache: 'cache.service.validation'
7 changes: 7 additions & 0 deletions tests/Functional/sf2_and_3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
framework:
annotations:
cache: 'cache.service.annotation'
serializer:
cache: 'cache.service.serializer'
validation:
cache: 'cache.service.validation'

0 comments on commit 7a44f15

Please sign in to comment.