diff --git a/.travis.yml b/.travis.yml index 62d38e8..67c2f21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ +language: php + dist: trusty +sudo: false -language: php +git: + depth: 1 branches: only: @@ -15,27 +19,35 @@ matrix: - php: 5.5 env: SYMFONY_VERSION=2.8.* - php: 5.6 - env: SYMFONY_VERSION=3.0.* - - php: 7.0 env: SYMFONY_VERSION=3.1.* + - php: 7.0 + env: PHP_CS_FIXER=true + - php: 7.1 + env: SYMFONY_VERSION=3.2.* TEST_COVERAGE=true - php: 7.1 - env: SYMFONY_VERSION=3.2.* - - php: hhvm + env: SYMFONY_VERSION=4.0.* DEPENDENCIES=dev + - php: nightly + env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs + allow_failures: + - php: nightly cache: directories: - $HOME/.composer/cache + - $HOME/.php_cs.cache + - vendor/ before_install: - - if [[ "$TRAVIS_PHP_VERSION" != "7.0" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini || true; fi + - if [ ${DEPENDENCIES} = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; + - if [[ ${TEST_COVERAGE} != true ]]; then phpenv config-rm xdebug.ini || true; fi - composer selfupdate - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" "symfony/framework-bundle:${SYMFONY_VERSION}" --dev --no-update; fi; + - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --dev --no-update; fi; -install: composer update --prefer-dist --no-interaction +install: composer update --prefer-source --no-interaction --optimize-autoloader ${COMPOSER_UPDATE_FLAGS} script: - - if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then bin/phpunit --debug --coverage-clover=build/logs/clover.xml; else bin/phpunit --debug; fi - - if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then composer require "friendsofphp/php-cs-fixer:^2.0" && bin/php-cs-fixer fix --diff --dry-run -v; fi; + - bin/phpunit --debug $( if [ $TEST_COVERAGE = true ]; then echo "-d xdebug.max_nesting_level=1000 --coverage-clover=build/logs/clover.xml"; fi; ) + - if [ ${PHP_CS_FIXER} = true ]; then composer require "friendsofphp/php-cs-fixer:^2.0" && bin/php-cs-fixer fix --diff --dry-run -v; fi; after_script: - - if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require "satooshi/php-coveralls:^1.0" && travis_retry php bin/coveralls -v; fi + - if [ ${TEST_COVERAGE} = true ]; then composer require "satooshi/php-coveralls:^1.0" && travis_retry php bin/coveralls -v; fi diff --git a/DependencyInjection/OverblogDataLoaderExtension.php b/DependencyInjection/OverblogDataLoaderExtension.php index b408fc0..7b0b5ea 100644 --- a/DependencyInjection/OverblogDataLoaderExtension.php +++ b/DependencyInjection/OverblogDataLoaderExtension.php @@ -52,6 +52,7 @@ public function load(array $configs, ContainerBuilder $container) if (isset($loaderConfig['alias'])) { $container->setAlias($loaderConfig['alias'], $dataLoaderServiceID); + $container->getAlias($loaderConfig['alias'])->setPublic(true); } } } diff --git a/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php b/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php index 455d067..e26c0b1 100644 --- a/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php +++ b/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php @@ -12,11 +12,12 @@ namespace Overblog\DataLoaderBundle\Tests\DependencyInjection; use Overblog\DataLoaderBundle\DependencyInjection\OverblogDataLoaderExtension; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -class OverblogDataLoaderExtensionTest extends \PHPUnit_Framework_TestCase +class OverblogDataLoaderExtensionTest extends TestCase { /** * @var ContainerBuilder @@ -193,7 +194,7 @@ private function assertDataLoaderService($serviceID, array $expectedArguments, $ $this->assertEquals($expectedArguments, $testDataLoaderDefinition->getArguments()); if ($alias) { - $this->assertEquals(new Alias($serviceID), $this->container->getAlias($alias)); + $this->assertEquals(new Alias($serviceID, true), $this->container->getAlias($alias)); } } diff --git a/Tests/Functional/BootTest.php b/Tests/Functional/BootTest.php index a56fd3c..30bdee8 100644 --- a/Tests/Functional/BootTest.php +++ b/Tests/Functional/BootTest.php @@ -13,9 +13,11 @@ class BootTest extends TestCase { - public function testBoot() + public function testBootAppKernel() { $kernel = $this->createKernel(); $kernel->boot(); + + $this->assertTrue($kernel->isBooted()); } } diff --git a/Tests/Functional/TestCase.php b/Tests/Functional/TestCase.php index 0cfd7d2..e0e9e0e 100644 --- a/Tests/Functional/TestCase.php +++ b/Tests/Functional/TestCase.php @@ -43,17 +43,10 @@ protected static function createKernel(array $options = []) $options['test_case'] = isset($options['test_case']) ? $options['test_case'] : null; - $env = isset($options['environment']) ? $options['environment'] : 'overblogdataloaderbundletest'.strtolower($options['test_case']); + $env = isset($options['environment']) ? $options['environment'] : 'test'.strtolower($options['test_case']); $debug = isset($options['debug']) ? $options['debug'] : true; - $kernelKey = $options['test_case'] ?: '__default__'; - $kernelKey .= '//'.$env.'//'.var_export($debug, true); - - if (!isset(self::$kernels[$kernelKey])) { - self::$kernels[$kernelKey] = new static::$class($env, $debug, $options['test_case']); - } - - return self::$kernels[$kernelKey]; + return new static::$class($env, $debug, $options['test_case']); } /** diff --git a/Tests/Functional/app/AppKernel.php b/Tests/Functional/app/AppKernel.php index 5c05040..5f98343 100644 --- a/Tests/Functional/app/AppKernel.php +++ b/Tests/Functional/app/AppKernel.php @@ -47,6 +47,11 @@ public function getRootDir() return __DIR__; } + public function isBooted() + { + return $this->booted; + } + /** * {@inheritdoc} */ diff --git a/composer.json b/composer.json index ae69c3a..4a628e9 100644 --- a/composer.json +++ b/composer.json @@ -23,19 +23,20 @@ "sort-packages": true }, "require": { - "php": "^5.5|^7.0", + "php": ">=5.5", "overblog/dataloader-php": "^0.5.0", - "symfony/framework-bundle": "^2.7|^3.1" + "symfony/dependency-injection": "^2.7 || ^3.1 || ^4.0" }, "require-dev": { - "phpunit/phpunit": "^4.1|^5.5", + "phpunit/phpunit": "^4.1 || ^5.5 || ^6.0", "react/promise": "^2.5", - "symfony/dependency-injection": "^2.7|^3.1", - "symfony/phpunit-bridge": "^2.7|^3.1" + "sensio/framework-extra-bundle": "^3.0", + "symfony/phpunit-bridge": "^2.7 || ^3.1 || ^4.0", + "symfony/yaml": "^2.7 || ^3.1 || ^4.0" }, "extra": { "branch-alias": { - "dev-master": "0.3-dev" + "dev-master": "0.4-dev" } } }