diff --git a/.travis.yml b/.travis.yml index 4433469..dfb25a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,32 @@ language: php php: - 5.3 - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - nightly -before_script: - - composer install --dev +matrix: + include: + - php: 5.3 + env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak + - php: 7.1 + env: DEPENDENCIES=dev SYMFONY_DEPRECATIONS_HELPER=weak + # Test against LTS versions + - php: 7.0 + env: SYMFONY_VERSION=2.8.* + allow_failures: + - php: nightly + +sudo: false + +cache: + directories: + - $HOME/.composer/cache/files + +before_install: + - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; + - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; + +install: composer update --prefer-dist $COMPOSER_FLAGS diff --git a/DependencyInjection/HBStampieExtension.php b/DependencyInjection/HBStampieExtension.php index f88cdaa..e243f5c 100644 --- a/DependencyInjection/HBStampieExtension.php +++ b/DependencyInjection/HBStampieExtension.php @@ -12,6 +12,7 @@ namespace HB\StampieBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\Config\FileLocator; @@ -25,7 +26,7 @@ class HBStampieExtension extends \Symfony\Component\HttpKernel\DependencyInjecti { public function load(array $configs, ContainerBuilder $container) { - $loader = new XmlFileLoader($container, new Filelocator(__DIR__ . '/../Resources/config')); + $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('config.xml'); $processor = new Processor(); @@ -42,15 +43,23 @@ public function load(array $configs, ContainerBuilder $container) throw new \InvalidArgumentException(sprintf('Invalid mailer "%s" specified', $config['mailer'])); } + if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) { + $definition = new ChildDefinition($mailerServiceId); + } else { + $definition = new DefinitionDecorator($mailerServiceId); + } + // get the abstract definition of an mailer and create "hb_stampie" based on it - $container - ->setDefinition('hb_stampie.mailer.real', new DefinitionDecorator($mailerServiceId)) + $definition ->setPublic(false) ->setArguments(array( $container->getDefinition($adapterServiceId), $config['server_token'], )) ; + + $container->setDefinition('hb_stampie.mailer.real', $definition); + $mailerId = 'hb_stampie.mailer.real'; if (isset($config['extra'])) { diff --git a/Resources/config/extra.xml b/Resources/config/extra.xml index e10f72c..40dc6c4 100644 --- a/Resources/config/extra.xml +++ b/Resources/config/extra.xml @@ -31,14 +31,12 @@ These are removed by the DI extension when they should not be activated. --> - - + - - + diff --git a/Tests/DependencyInjection/HBStampieExtensionTest.php b/Tests/DependencyInjection/HBStampieExtensionTest.php index 8ec9543..3e10f01 100644 --- a/Tests/DependencyInjection/HBStampieExtensionTest.php +++ b/Tests/DependencyInjection/HBStampieExtensionTest.php @@ -11,7 +11,10 @@ */ class HBStampieExtensionTest extends \PHPUnit_Framework_TestCase { - public function setUp() + /** @var HBStampieExtension */ + private $extension; + + protected function setUp() { $this->extension = new HBStampieExtension(); } diff --git a/composer.json b/composer.json index 056e51f..65b4d15 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "henrikbjorn/stampie-bundle", "description": "This bundle provides integration for Stampie Email Library", - "keywords": ["symfony2", "stampie", "email"], + "keywords": ["symfony", "stampie", "email"], "type": "symfony-bundle", "license": "MIT", "authors": [{ @@ -10,12 +10,13 @@ }], "require": { "php" : ">=5.3.3", - "symfony/framework-bundle" : "~2.0", - "symfony/console" : "~2.0", - "henrikbjorn/stampie" : "~0.6" + "symfony/framework-bundle" : "^2.7 || ^3.0", + "symfony/console" : "^2.7 || ^3.0", + "henrikbjorn/stampie" : "~0.11" }, "require-dev": { - "stof/stampie-extra": "~0.2@dev" + "stof/stampie-extra": "~0.2@dev", + "symfony/phpunit-bridge": "^3.2" }, "suggest": { "stof/stampie-extra": "to have event-based hooks in the mailer"