Skip to content

Commit

Permalink
Merge pull request #23 from gregurco/support_guzzle_bundle_v8
Browse files Browse the repository at this point in the history
Support Guzzle Bundle v8
  • Loading branch information
gregurco authored Feb 28, 2020
2 parents ba17eb7 + 4572ca7 commit bfbb9b3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 41 deletions.
31 changes: 15 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,46 @@ language: php
sudo: false

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
- SYMFONY_VERSION=2.7.* # LTS
- SYMFONY_VERSION=2.8.* # LTS
- SYMFONY_VERSION=3.2.*
- SYMFONY_VERSION=3.3.*
- SYMFONY_VERSION=3.4.* # LTS
- SYMFONY_VERSION=4.0.*
- SYMFONY_VERSION=4.1.* # (until 07/2019)
- SYMFONY_VERSION=4.2.* # (until 01/2020)
- SYMFONY_VERSION=4.3.* # (until 07/2020)
- SYMFONY_VERSION=4.4.* # LTS (11/2019, until 11/2023)
- SYMFONY_VERSION=5.0.* # (until 07/2020)
- DEPENDENCIES=dev

cache:
directories:
- $HOME/.composer/cache/files

before_install:
- composer self-update
- if [ "$DEPENDENCIES" == "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$DEPENDENCIES" == "dev" ]; then composer config minimum-stability $DEPENDENCIES; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer --no-update require symfony/symfony:${SYMFONY_VERSION}; fi;

install:
- composer update

script:
- mkdir -p build/logs
- php vendor/bin/phpunit --coverage-text
- composer validate --strict --no-check-lock
- vendor/bin/phpunit --coverage-text --verbose

after_success:
- travis_retry php vendor/bin/coveralls
- travis_retry php vendor/bin/php-coveralls

matrix:
exclude:
- php: 7
env: SYMFONY_VERSION=4.0.* # requires PHP ^7.1.3
- php: 7
env: SYMFONY_VERSION=dev-master # requires PHP ^7.1.3
- php: 7.1
env: SYMFONY_VERSION=5.0.* # requires PHP ^7.2.5
allow_failures:
- env: DEPENDENCIES=dev
- php: nightly
- env: SYMFONY_VERSION=dev-master

notifications:
email:
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
],

"require": {
"php": "^7.0",
"php": ">=7.1",
"guzzlehttp/guzzle": "^6.0",
"eightpoints/guzzle-bundle": "~7.1",
"symfony/http-kernel": "~2.7|~3.0|~4.0|~5.0",
"symfony/config": "~2.7|~3.0|~4.0|~5.0",
"symfony/dependency-injection": "~2.7|~3.0|~4.0|~5.0",
"symfony/expression-language": "~2.7|~3.0|~4.0|~5.0",
"eightpoints/guzzle-bundle": "^8.0.1",
"symfony/http-kernel": "~4.0|~5.0",
"symfony/config": "~4.0|~5.0",
"symfony/dependency-injection": "~4.0|~5.0",
"symfony/expression-language": "~4.0|~5.0",
"sainsburys/guzzle-oauth2-plugin": "^3.0.5"
},

"require-dev": {
"phpunit/phpunit": "~6.1",
"satooshi/php-coveralls": "~1.0"
"phpunit/phpunit": "~7.5",
"php-coveralls/php-coveralls": "~2.2"
},

"autoload": {
Expand Down
10 changes: 5 additions & 5 deletions src/GuzzleBundleOAuth2Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Gregurco\Bundle\GuzzleBundleOAuth2Plugin;


use EightPoints\Bundle\GuzzleBundle\PluginInterface;
use Gregurco\Bundle\GuzzleBundleOAuth2Plugin\DependencyInjection\GuzzleBundleOAuth2Extension;
use EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundlePlugin;
use Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials;
use Sainsburys\Guzzle\Oauth2\GrantType\GrantTypeBase;
use Sainsburys\Guzzle\Oauth2\GrantType\GrantTypeInterface;
Expand All @@ -20,13 +20,13 @@
use Symfony\Component\ExpressionLanguage\Expression;
use GuzzleHttp\Client;

class GuzzleBundleOAuth2Plugin extends Bundle implements EightPointsGuzzleBundlePlugin
class GuzzleBundleOAuth2Plugin extends Bundle implements PluginInterface
{
/**
* @param array $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container) : void
{
$extension = new GuzzleBundleOAuth2Extension();
$extension->load($configs, $container);
Expand All @@ -38,7 +38,7 @@ public function load(array $configs, ContainerBuilder $container)
* @param string $clientName
* @param Definition $handler
*/
public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler)
public function loadForClient(array $config, ContainerBuilder $container, string $clientName, Definition $handler) : void
{
if ($config['enabled']) {
$middlewareConfig = [
Expand Down Expand Up @@ -141,7 +141,7 @@ public function loadForClient(array $config, ContainerBuilder $container, string
/**
* @param ArrayNodeDefinition $pluginNode
*/
public function addConfiguration(ArrayNodeDefinition $pluginNode)
public function addConfiguration(ArrayNodeDefinition $pluginNode) : void
{
$pluginNode
->canBeEnabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class GuzzleBundleOAuth2ExtensionTest extends TestCase
{
public function testLoad()
public function testLoad() : void
{
$container = new ContainerBuilder();

Expand Down
22 changes: 11 additions & 11 deletions tests/GuzzleBundleOAuth2PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Gregurco\Bundle\GuzzleBundleOAuth2Plugin\Test;

use EightPoints\Bundle\GuzzleBundle\DependencyInjection\Configuration;
use EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundlePlugin;
use EightPoints\Bundle\GuzzleBundle\PluginInterface;
use Gregurco\Bundle\GuzzleBundleOAuth2Plugin\GuzzleBundleOAuth2Plugin;
use Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials;
use Sainsburys\Guzzle\Oauth2\GrantType\GrantTypeInterface;
Expand All @@ -24,20 +24,20 @@ class GuzzleBundleOAuth2PluginTest extends TestCase
/** @var GuzzleBundleOAuth2Plugin */
protected $plugin;

public function setUp()
public function setUp() : void
{
parent::setUp();

$this->plugin = new GuzzleBundleOAuth2Plugin();
}

public function testSubClassesOfPlugin()
public function testSubClassesOfPlugin() : void
{
$this->assertInstanceOf(EightPointsGuzzleBundlePlugin::class, $this->plugin);
$this->assertInstanceOf(PluginInterface::class, $this->plugin);
$this->assertInstanceOf(Bundle::class, $this->plugin);
}

public function testAddConfiguration()
public function testAddConfiguration() : void
{
$arrayNode = new ArrayNodeDefinition('node');

Expand Down Expand Up @@ -69,12 +69,12 @@ public function testAddConfiguration()
);
}

public function testGetPluginName()
public function testGetPluginName() : void
{
$this->assertEquals('oauth2', $this->plugin->getPluginName());
}

public function testLoad()
public function testLoad() : void
{
$container = new ContainerBuilder();

Expand All @@ -87,7 +87,7 @@ public function testLoad()
);
}

public function testLoadForClient()
public function testLoadForClient() : void
{
$handler = new Definition();
$container = new ContainerBuilder();
Expand Down Expand Up @@ -120,7 +120,7 @@ public function testLoadForClient()
$this->assertCount(3, $clientMiddlewareDefinition->getArguments());
}

public function testLoadForClientWithPrivateKey()
public function testLoadForClientWithPrivateKey() : void
{
$handler = new Definition();
$container = new ContainerBuilder();
Expand Down Expand Up @@ -163,7 +163,7 @@ public function testLoadForClientWithPrivateKey()
*
* @param array $pluginConfiguration
*/
public function testAddConfigurationWithData(array $pluginConfiguration)
public function testAddConfigurationWithData(array $pluginConfiguration) : void
{
$config = [
'eight_points_guzzle' => [
Expand Down Expand Up @@ -239,7 +239,7 @@ public function provideValidConfigurationData() : array
* @param array $pluginConfiguration
* @param string $message
*/
public function testAddConfigurationWithInvalidData(array $pluginConfiguration, string $message)
public function testAddConfigurationWithInvalidData(array $pluginConfiguration, string $message) : void
{
$this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage($message);
Expand Down

0 comments on commit bfbb9b3

Please sign in to comment.