From 7de22010b712528fb604be0d469aff46a6e46c5b Mon Sep 17 00:00:00 2001 From: Tri Tran Date: Wed, 7 Feb 2018 11:36:59 +0700 Subject: [PATCH 1/2] Compatible with Symfony 4 --- .travis.yml | 8 +- DependencyInjection/Compiler/SQSQueuePass.php | 4 +- Resources/config/services.xml | 4 +- Tests/app/AppKernel.php | 3 +- Tests/app/KernelTestCase.php | 12 +++ Tests/app/config/config_test.yml | 4 +- composer.json | 75 +++++++++++-------- phpunit.xml.dist | 2 +- 8 files changed, 64 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8165ec..64e5273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,7 @@ language: php php: - 7.0 - 7.1 -env: - - SYMFONY="2.7.*" - - SYMFONY="~3.0" -services: - - elasticsearch -install: - - composer require --no-update symfony/symfony:${SYMFONY} + - 7.2 before_script: - composer install --no-interaction --prefer-dist script: diff --git a/DependencyInjection/Compiler/SQSQueuePass.php b/DependencyInjection/Compiler/SQSQueuePass.php index d11f9c9..e16992e 100644 --- a/DependencyInjection/Compiler/SQSQueuePass.php +++ b/DependencyInjection/Compiler/SQSQueuePass.php @@ -58,7 +58,9 @@ public function process(ContainerBuilder $container) new Reference('tritran.sqs_queue.queue_factory'), 'create' ] - )->setArguments([ + ) + ->setPublic(true) + ->setArguments([ $queueName, $queueOption['queue_url'], $callable, diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 7698c83..82939c9 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -9,13 +9,13 @@ - + - + diff --git a/Tests/app/AppKernel.php b/Tests/app/AppKernel.php index 3d8f4dc..5558139 100644 --- a/Tests/app/AppKernel.php +++ b/Tests/app/AppKernel.php @@ -15,7 +15,6 @@ public function registerBundles() { return [ new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new \Symfony\Bundle\TwigBundle\TwigBundle(), new \Aws\Symfony\AwsBundle(), new \TriTran\SqsQueueBundle\TriTranSqsQueueBundle() ]; @@ -30,4 +29,4 @@ public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml'); } -} \ No newline at end of file +} diff --git a/Tests/app/KernelTestCase.php b/Tests/app/KernelTestCase.php index 806a802..92e6d7a 100644 --- a/Tests/app/KernelTestCase.php +++ b/Tests/app/KernelTestCase.php @@ -2,6 +2,7 @@ namespace TriTran\SqsQueueBundle\Tests\app; +use AppKernel; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase as SymfonyKernelTestCase; use Symfony\Component\Console\Application; @@ -47,6 +48,17 @@ protected function getContainer($reinitialize = false, array $kernelOptions = [] return $this->container; } + /** + * @inheritdoc + */ + protected static function createKernel(array $options = []) + { + $kernel = new AppKernel('test', true); + $kernel->boot(); + + return $kernel; + } + /** * @param ContainerAwareCommand $command * diff --git a/Tests/app/config/config_test.yml b/Tests/app/config/config_test.yml index 51c0c28..2cc3530 100644 --- a/Tests/app/config/config_test.yml +++ b/Tests/app/config/config_test.yml @@ -3,9 +3,7 @@ framework: secret: 'secret' router: resource: ~ - strict_requirements: %kernel.debug% - templating: - engines: ['twig'] + strict_requirements: '%kernel.debug%' test: ~ aws: diff --git a/composer.json b/composer.json index 6628df4..c1dcd2c 100644 --- a/composer.json +++ b/composer.json @@ -1,35 +1,46 @@ { - "name": "tritran/sqs-queue-bundle", - "description": "Simple SQS Queue for Symfony", - "type": "symfony-bundle", - "homepage": "http://www.ideason.vn", - "license": "MIT", - "authors": [ - { - "name": "Tri D. Tran", - "homepage": "http://www.ideason.vn" - } - ], - "require": { - "php": ">=5.5", - "symfony/symfony": "~2.7|~3.0", - "aws/aws-sdk-php-symfony": "~1.0" - }, - "require-dev": { - "symfony/monolog-bundle": "~2.5", - "symfony/monolog-bridge": "~2.4", - "phpunit/phpunit": "6.0.*", - "phpmd/phpmd": "2.6.*", - "squizlabs/php_codesniffer": "^3.0" - }, - "suggest": { - }, - "autoload": { - "psr-4": { - "TriTran\\SqsQueueBundle\\": "" + "name": "tritran/sqs-queue-bundle", + "description": "Simple SQS Queue for Symfony", + "type": "symfony-bundle", + "homepage": "http://www.ideason.vn", + "license": "MIT", + "authors": [ + { + "name": "Tri D. Tran", + "homepage": "http://www.ideason.vn" + } + ], + "require": { + "php": ">=7.0.0", + "symfony/dependency-injection": "~2.7|~3.3|~4.0", + "symfony/config": "~2.8|~3.3|~4.0", + "symfony/console": "~2.7|~3.3|~4.0", + "aws/aws-sdk-php-symfony": "~2.0" + }, + "require-dev": { + "symfony/framework-bundle": "~2.3|~3.0|~4.0", + "symfony/yaml": "~2.3|~3.0|~4.0", + "phpunit/phpunit": "6.0.*", + "phpmd/phpmd": "2.6.*", + "squizlabs/php_codesniffer": "^3.0" + }, + "suggest": { }, - "exclude-from-classmap": [ - "/Tests/" - ] - } + "autoload": { + "psr-4": { + "TriTran\\SqsQueueBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/app/cache/", + "/Tests/app/logs/" + ] + }, + "autoload-dev": { + "psr-4": { + "TriTran\\SqsQueueBundle\\": "Tests/" + }, + "classmap": [ + "Tests/app" + ] + } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 467f4d1..b4da14a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -24,7 +24,7 @@ - + From 554829682b86bc6d800e59f80eb2cf20d670238d Mon Sep 17 00:00:00 2001 From: Tri Tran Date: Wed, 7 Feb 2018 13:54:08 +0700 Subject: [PATCH 2/2] Add more Command as service --- Resources/config/services.xml | 40 +++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 82939c9..7115782 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -1,12 +1,12 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + @@ -16,7 +16,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +