From fff6b1153a193b00f2ebf4356701207c2e758a5b Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Wed, 27 Nov 2019 14:43:37 -0600 Subject: [PATCH 1/4] Allow use with Symfony 5 --- .travis.yml | 7 +++++-- composer.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cb34e1..7831867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ language: php php: - 7.1 - 7.2 + - 7.3 - nightly env: @@ -20,9 +21,11 @@ matrix: env: COMPOSER_FLAGS="--prefer-lowest" - php: 7.2 env: SYMFONY_VERSION=3.* - - php: 7.2 + - php: 7.3 env: SYMFONY_VERSION=4.* - - php: 7.2 + - php: 7.3 + env: SYMFONY_VERSION=5.* + - php: 7.3 env: SYMFONY_VERSION=dev-master allow_failures: - php: nightly diff --git a/composer.json b/composer.json index 2e52a87..1a43482 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": "^7.1", "nexylan/slack": "^2.2", "php-http/httplug-bundle": "^1.8", - "symfony/http-kernel": "^3.4 || ^4.0" + "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^2.3", From 48fac0458463f942b57b4e78481aced1ec73a90d Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Wed, 27 Nov 2019 14:59:38 -0600 Subject: [PATCH 2/4] Raise minimum PHP to 7.2, adjust required test framework dependencies --- .gitignore | 1 + .travis.yml | 3 +-- composer.json | 6 +++--- phpunit.xml.dist | 3 +-- tests/DependencyInjection/ConfigurationTest.php | 6 ++++-- tests/DependencyInjection/NexySlackExtensionTest.php | 2 +- tests/NexySlackBundleTest.php | 3 +++ 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 16fd97f..a5d51fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /composer.lock /vendor/ /.php_cs.cache +/.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index 7831867..1372c40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ branches: language: php php: - - 7.1 - 7.2 - 7.3 - nightly @@ -17,7 +16,7 @@ env: matrix: fast_finish: true include: - - php: 7.1 + - php: 7.2 env: COMPOSER_FLAGS="--prefer-lowest" - php: 7.2 env: SYMFONY_VERSION=3.* diff --git a/composer.json b/composer.json index 1a43482..ad182b3 100644 --- a/composer.json +++ b/composer.json @@ -10,15 +10,15 @@ } ], "require": { - "php": "^7.1", + "php": "^7.2", "nexylan/slack": "^2.2", "php-http/httplug-bundle": "^1.8", "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^2.3", + "matthiasnoback/symfony-dependency-injection-test": "^4.0", "php-http/mock-client": "^1.1", - "phpunit/phpunit": "^6.5" + "phpunit/phpunit": "^8.0" }, "suggest": { "eightpoints/guzzle-bundle": "Make a custom Guzzle instance for Slack with ease" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4d1eccc..b715a4b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,8 +8,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" - syntaxCheck="false"> + stopOnFailure="false"> ./tests/ diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 2398ee9..cc5e8e5 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -16,6 +16,8 @@ use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; use Nexy\SlackBundle\DependencyInjection\Configuration; use Nexy\SlackBundle\DependencyInjection\NexySlackExtension; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** * @author Sullivan Senechal @@ -68,7 +70,7 @@ public function testFullConfigurationProcess(): void /** * {@inheritdoc} */ - protected function getContainerExtension() + protected function getContainerExtension(): ExtensionInterface { return new NexySlackExtension(); } @@ -76,7 +78,7 @@ protected function getContainerExtension() /** * {@inheritdoc} */ - protected function getConfiguration() + protected function getConfiguration(): ConfigurationInterface { return new Configuration(); } diff --git a/tests/DependencyInjection/NexySlackExtensionTest.php b/tests/DependencyInjection/NexySlackExtensionTest.php index 12460a4..854e0a6 100644 --- a/tests/DependencyInjection/NexySlackExtensionTest.php +++ b/tests/DependencyInjection/NexySlackExtensionTest.php @@ -81,7 +81,7 @@ public function testLoadWithCustomConfiguration(): void /** * {@inheritdoc} */ - protected function getContainerExtensions() + protected function getContainerExtensions(): array { return [ new NexySlackExtension(), diff --git a/tests/NexySlackBundleTest.php b/tests/NexySlackBundleTest.php index 6508478..c38173f 100644 --- a/tests/NexySlackBundleTest.php +++ b/tests/NexySlackBundleTest.php @@ -33,6 +33,9 @@ protected function setUp(): void $this->bundle = new NexySlackBundle(); } + /** + * @doesNotPerformAssertions + */ public function testBuild(): void { $this->bundle->build($this->container); From dc4a52309d4747fba8bc8040381a776a05fbc4b3 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 28 Dec 2019 14:49:45 -0600 Subject: [PATCH 3/4] Bump HttplugBundle dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ad182b3..5cb2958 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": "^7.2", "nexylan/slack": "^2.2", - "php-http/httplug-bundle": "^1.8", + "php-http/httplug-bundle": "^1.17", "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { From 3d644ad16285d86daace52f073a4f804e314825d Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 28 Dec 2019 15:23:26 -0600 Subject: [PATCH 4/4] Upgrade nexylan/slack dependency to 3.0 --- .travis.yml | 5 ++--- composer.json | 4 ++-- src/DependencyInjection/Configuration.php | 2 ++ src/DependencyInjection/NexySlackExtension.php | 2 ++ src/Resources/config/client.xml | 12 +++++++++++- tests/DependencyInjection/ConfigurationTest.php | 4 ++++ tests/DependencyInjection/NexySlackExtensionTest.php | 10 +++++++--- 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1372c40..95653ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ branches: language: php php: - - 7.2 - 7.3 - nightly @@ -16,9 +15,9 @@ env: matrix: fast_finish: true include: - - php: 7.2 + - php: 7.3 env: COMPOSER_FLAGS="--prefer-lowest" - - php: 7.2 + - php: 7.3 env: SYMFONY_VERSION=3.* - php: 7.3 env: SYMFONY_VERSION=4.* diff --git a/composer.json b/composer.json index 5cb2958..8bc88aa 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ } ], "require": { - "php": "^7.2", - "nexylan/slack": "^2.2", + "php": "^7.3", + "nexylan/slack": "^3.0", "php-http/httplug-bundle": "^1.17", "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0" }, diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 2e13fec..1674475 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -38,6 +38,8 @@ public function getConfigTreeBuilder(): TreeBuilder ->addDefaultsIfNotSet() ->children() ->scalarNode('client')->defaultValue('httplug.client')->end() + ->scalarNode('request_factory')->defaultValue('nexy_slack.request_factory.default')->end() + ->scalarNode('stream_factory')->defaultValue('nexy_slack.stream_factory.default')->end() ->end() ->end() ->scalarNode('endpoint') diff --git a/src/DependencyInjection/NexySlackExtension.php b/src/DependencyInjection/NexySlackExtension.php index e2e1854..ce53fba 100644 --- a/src/DependencyInjection/NexySlackExtension.php +++ b/src/DependencyInjection/NexySlackExtension.php @@ -31,6 +31,8 @@ public function load(array $configs, ContainerBuilder $container): void $container->setParameter('nexy_slack.endpoint', $config['endpoint']); $container->setAlias('nexy_slack.http.client', new Alias($config['http']['client'], false)); + $container->setAlias('nexy_slack.http.request_factory', new Alias($config['http']['request_factory'], false)); + $container->setAlias('nexy_slack.http.stream_factory', new Alias($config['http']['stream_factory'], false)); // Unset the not needed keys for the Slack config. unset($config['http'], $config['endpoint']); diff --git a/src/Resources/config/client.xml b/src/Resources/config/client.xml index f4b62f0..4f85e1a 100644 --- a/src/Resources/config/client.xml +++ b/src/Resources/config/client.xml @@ -6,11 +6,21 @@ + + + %nexy_slack.endpoint% %nexy_slack.config% - + + + + + + + + diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index cc5e8e5..3c753e2 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -29,6 +29,8 @@ public function testMinimalConfigurationProcess(): void $expectedConfiguration = [ 'http' => [ 'client' => 'httplug.client', + 'request_factory' => 'nexy_slack.request_factory.default', + 'stream_factory' => 'nexy_slack.stream_factory.default', ], 'sticky_channel' => false, 'endpoint' => 'https://hooks.slack.com/services/XXXXX/XXXXX/XXXXXXXXXX', @@ -47,6 +49,8 @@ public function testFullConfigurationProcess(): void $expectedConfiguration = [ 'http' => [ 'client' => 'httplug.curl', + 'request_factory' => 'nexy_slack.request_factory.default', + 'stream_factory' => 'nexy_slack.stream_factory.default', ], 'sticky_channel' => false, 'endpoint' => 'https://hooks.slack.com/services/XXXXX/XXXXX/XXXXXXXXXX', diff --git a/tests/DependencyInjection/NexySlackExtensionTest.php b/tests/DependencyInjection/NexySlackExtensionTest.php index 854e0a6..6d27ea1 100644 --- a/tests/DependencyInjection/NexySlackExtensionTest.php +++ b/tests/DependencyInjection/NexySlackExtensionTest.php @@ -49,12 +49,16 @@ public function testLoadWithMinimalConfiguration(): void $this->assertContainerBuilderHasService(Client::class); - $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 0, '%nexy_slack.endpoint%'); - $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 1, '%nexy_slack.config%'); - $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 2, new Reference('nexy_slack.http.client')); + $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 0, new Reference('nexy_slack.http.client')); + $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 1, new Reference('nexy_slack.http.request_factory')); + $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 2, new Reference('nexy_slack.http.stream_factory')); + $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 3, '%nexy_slack.endpoint%'); + $this->assertContainerBuilderHasServiceDefinitionWithArgument(Client::class, 4, '%nexy_slack.config%'); $this->assertContainerBuilderHasAlias('nexy_slack.client', Client::class); $this->assertContainerBuilderHasAlias('nexy_slack.http.client', 'httplug.client'); + $this->assertContainerBuilderHasAlias('nexy_slack.http.request_factory', 'nexy_slack.request_factory.default'); + $this->assertContainerBuilderHasAlias('nexy_slack.http.stream_factory', 'nexy_slack.stream_factory.default'); } public function testLoadWithCustomConfiguration(): void