Allow Symfony 4 (#383)

master v2.0.0
Théo FIDRY 5 years ago committed by GitHub
parent aa08bf7f5b
commit b167479bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      .travis.yml
  2. 2
      composer.json
  3. 36
      fixtures/Functional/AppKernel.php
  4. 1
      fixtures/Functional/config/config.yml
  5. 3
      resources/config/command.xml
  6. 3
      resources/config/loader.xml
  7. 3
      resources/config/locator.xml
  8. 6
      resources/config/resolver.xml
  9. 2
      tests/DependencyInjection/HautelookAliceBundleTest.php

@ -2,6 +2,7 @@ language: php
php:
- '7.1'
- '7.2'
- nightly
branches:
@ -32,16 +33,15 @@ matrix:
- COVERAGE="true"
- PHPUNIT_FLAGS="--stop-on-failure --verbose --coverage-text --coverage-clover=coverage.xml"
- SYMFONY_VERSION="~3.3.10"
- php: '7.1'
env: SYMFONY_VERSION='~3.3'
- php: '7.1'
env: SYMFONY_VERSION='~3.4.0@dev'
- php: '7.1'
env: SYMFONY_VERSION='~4.0.0@dev'
- php: '7.2'
env: SYMFONY_VERSION='~3.4.0'
- php: '7.2'
env: SYMFONY_VERSION='~4.0.0'
- php: '7.2'
env: SYMFONY_VERSION='~4.1.0@dev'
allow_failures:
- php: nightly
- env: SYMFONY_VERSION='~3.4.0@dev'
- env: SYMFONY_VERSION='~4.0.0@dev'
- env: SYMFONY_VERSION='~4.1.0@dev'
before_install:
- set -eo pipefail

@ -34,7 +34,7 @@
"php": "^7.1",
"nelmio/alice": "^3.1",
"symfony/finder": "^3.3 || ^4.0",
"theofidry/alice-data-fixtures": "^1.0-rc1@rc",
"theofidry/alice-data-fixtures": "^1.0-rc1",
"psr/log": "^1.0"
},
"require-dev": {

@ -17,13 +17,16 @@ use Hautelook\AliceBundle\HautelookAliceBundle;
use Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
/**
* @author Théo FIDRY <theo.fidry@gmail.com>
*/
class AppKernel extends Kernel
{
/**
* @inheritdoc
*/
public function registerBundles()
{
return [
@ -35,9 +38,36 @@ class AppKernel extends Kernel
];
}
/**
* @inheritdoc
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config.yml');
$loader->load(__DIR__.'/config/doctrine.yml');
}
/**
* @inheritdoc
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
if ('public' !== $this->getEnvironment()) {
return;
}
$container->addCompilerPass(new class() implements CompilerPassInterface {
public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $id => $definition) {
$definition->setPublic(true);
}
foreach ($container->getAliases() as $id => $definition) {
$definition->setPublic(true);
}
}
}, PassConfig::TYPE_OPTIMIZE);
}
}

@ -20,6 +20,7 @@ services:
app.city_factory:
class: Hautelook\AliceBundle\Functional\TestBundle\Entity\CityFactory
public: true
logger:
class: Psr\Log\NullLogger

@ -5,7 +5,8 @@
<services>
<service id="hautelook_alice.console.command.doctrine.doctrine_orm_load_data_fixtures_command"
class="Hautelook\AliceBundle\Console\Command\Doctrine\DoctrineOrmLoadDataFixturesCommand">
class="Hautelook\AliceBundle\Console\Command\Doctrine\DoctrineOrmLoadDataFixturesCommand"
public="true">
<argument type="string">hautelook:fixtures:load</argument>
<argument type="service" id="doctrine" />
<argument type="service" id="hautelook_alice.loader" />

@ -36,7 +36,8 @@
</service>
<service id="hautelook_alice.loader"
alias="hautelook_alice.loader.doctrine_orm_loader" />
alias="hautelook_alice.loader.doctrine_orm_loader"
public="true" />
</services>
</container>

@ -16,7 +16,8 @@
</service>
<service id="hautelook_alice.locator"
alias="hautelook_alice.locator.environmentless" />
alias="hautelook_alice.locator.environmentless"
public="true" />
</services>
</container>

@ -16,7 +16,8 @@
</service>
<service id="hautelook_alice.resolver.bundle"
alias="hautelook_alice.resolver.bundle.no_bundle_resolver" />
alias="hautelook_alice.resolver.bundle.no_bundle_resolver"
public="true" />
<!-- File -->
@ -26,7 +27,8 @@
</service>
<service id="hautelook_alice.resolver.file"
alias="hautelook_alice.resolver.file.kernel_file_resolver" />
alias="hautelook_alice.resolver.file.kernel_file_resolver"
public="true" />
</services>
</container>

@ -62,7 +62,7 @@ class HautelookAliceBundleTest extends TestCase
public function testServiceRegistration()
{
$this->kernel = new AppKernel('dev', true);
$this->kernel = new AppKernel('public', true);
$this->kernel->boot();
// Resolvers

Loading…
Cancel
Save