Skip to content

Commit

Permalink
Merge branch 'upgrade-sf-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe BOUCAUT committed Oct 1, 2018
2 parents 12af67e + 700b0af commit 5018e87
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 45 deletions.
37 changes: 28 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,42 @@ php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false
matrix:
include:
- php: 5.3
env: |
COMPOSER_FLAGS='--prefer-stable --prefer-lowest'
SYMFONY_VERSION=2.3.*
- php: 5.6
env: |
SYMFONY_VERSION=2.7.*
- php: 5.6
env: |
SYMFONY_VERSION=2.8.*
- php: 5.6
env: |
SYMFONY_VERSION=3.4.14
env:
- SYMFONY_VERSION=2.6.*
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=dev-master

before_script:
- composer self-update
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
- sh -c "if [ '$TRAVIS_PHP_VERSION' = 'hhvm' ]; then composer remove doctrine/dbal --dev --no-interaction --no-update; fi;"
- composer update --no-interaction --prefer-source
# Update composer
- travis_retry composer self-update --no-interaction;
# Set symfony version dependency
- if [ "${SYMFONY_VERSION}" != "" ]; then composer require --no-update symfony/symfony=${SYMFONY_VERSION}; fi;
# Install composer dependencies
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction;s

script:
- phpunit --coverage-text
- vendor/bin/phpunit --coverage-text

matrix:
allow_failures:
- php: hhvm
- env: SYMFONY_VERSION=dev-master
cache:
directories:
- $HOME/.composer/cache
4 changes: 4 additions & 0 deletions DependencyInjection/GeneanetI18nRoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function load(array $configs, ContainerBuilder $container)

case 'doctrine_dbal':
$loader->load('dbal.xml');

$def = $container->getDefinition('geneanet_i18n_routing.doctrine_dbal.connection');
$def->setFactory(array(new Reference('doctrine'), 'getConnection'));

$this->configureCacheDefinition($config['cache'], $container);
$container->setAlias('geneanet_i18n_routing.translator', 'geneanet_i18n_routing.translator.doctrine_dbal');

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ geneanet_i18n_routing:
id: my_attribute_translator
```

## Run tests

Run ```vendor/bin/phpunit Tests/```.
NB : You need to install php-sqlite3.

## License

This bundle is under the MIT license. See the complete license in the bundle:
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/dbal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<argument type="service" id="geneanet_i18n_routing.doctrine_dbal.cache" />
</service>

<service id="geneanet_i18n_routing.doctrine_dbal.connection" factory-service="doctrine" factory-method="getConnection" class="Doctrine\DBAL\Connection" public="false">
<service id="geneanet_i18n_routing.doctrine_dbal.connection" class="Doctrine\DBAL\Connection" public="false">
<argument>%geneanet_i18n_routing.doctrine_dbal.connection_name%</argument>
</service>

Expand Down
2 changes: 1 addition & 1 deletion Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function setDefaultLocale($locale)
*
* @throws RouteNotFoundException When the route doesn't exists
*/
protected function generateI18n($name, $locale, $parameters, $referenceType)
protected function generateI18n($name, $locale, $parameters, $referenceType = self::ABSOLUTE_PATH)
{
try {
return $this->router->generate($name.'.'.$locale, $parameters, $referenceType);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Routing/I18nRouteCollectionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testCollection($name, $locales, $defaults, $requirements, $optio
$defaults['_locale'] = $locale;
$options['compiler_class'] = 'Symfony\\Component\\Routing\\RouteCompiler';

$this->assertEquals($pattern, $route->getPattern(), '(pattern)');
$this->assertEquals($pattern, $route->getPath(), '(path)');
$this->assertEquals($defaults, $route->getDefaults(), '(defaults)');
$this->assertEquals($requirements, $route->getRequirements(), '(requirements)');
$this->assertEquals($options, $route->getOptions(), '(options)');
Expand Down
22 changes: 0 additions & 22 deletions Tests/autoload.php.dist

This file was deleted.

7 changes: 0 additions & 7 deletions Tests/bootstrap.php

This file was deleted.

13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@
}
],
"require": {
"symfony/framework-bundle": "~2.6"
"symfony/routing": "~2.6 || ~3.4.14",
"symfony/config": "~2.6 || ~3.4.14"
},
"require-dev": {
"doctrine/dbal": "~2.0"
"doctrine/dbal": "~2.2",

"symfony/dependency-injection": "~2.6 || ~3.4.14",
"symfony/http-kernel": "~2.6 || ~3.4.14",
"symfony/translation": "~2.6 || ~3.4.14",

"phpunit/phpunit": "~4.8.36"
},
"suggest": {
"doctrine/dbal": "~2.0"
"doctrine/dbal": "~2.2"
},
"autoload": {
"psr-0": { "Geneanet\\I18nRoutingBundle": "" }
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="./Tests/bootstrap.php">
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="GeneanetI18nRoutingBundle Test Suite">
<directory suffix="Test.php">./Tests</directory>
Expand Down

0 comments on commit 5018e87

Please sign in to comment.