Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supports for Symfony 4 #12

Merged
merged 1 commit into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
language: php

dist: trusty
sudo: false

language: php
git:
depth: 1

branches:
only:
Expand All @@ -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.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep one 7.0 build?

- 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
1 change: 1 addition & 0 deletions DependencyInjection/OverblogDataLoaderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Functional/BootTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

class BootTest extends TestCase
{
public function testBoot()
public function testBootAppKernel()
{
$kernel = $this->createKernel();
$kernel->boot();

$this->assertTrue($kernel->isBooted());
}
}
11 changes: 2 additions & 9 deletions Tests/Functional/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions Tests/Functional/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function getRootDir()
return __DIR__;
}

public function isBooted()
{
return $this->booted;
}

/**
* {@inheritdoc}
*/
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}