Skip to content

Commit

Permalink
Proper Symfony 4 support (#19)
Browse files Browse the repository at this point in the history
* Proper Symfony 4 support

#SymfonyHackday

* Update .travis.yml
  • Loading branch information
lolautruche authored Nov 23, 2019
1 parent 60c40b3 commit a891d5f
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 55 deletions.
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ cache:
- $HOME/.composer/cache

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

branches:
only:
Expand All @@ -17,12 +18,14 @@ branches:

matrix:
include:
- php: 5.6
env: SYMFONY_VERSION='~2.7.10'
- php: 5.6
env: SYMFONY_VERSION='^2.8'
- php: 7.0
env: SYMFONY_VERSION='^2.8'
- php: 7.1
env: SYMFONY_VERSION='^3.4'
- php: 7.1
env: SYMFONY_VERSION='^4.0'
- php: 7.2
env: SYMFONY_VERSION='^4.0'
- php: 7.3
env: SYMFONY_VERSION='^4.0'

before_install:
- sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update symfony/symfony=$SYMFONY_VERSION; fi;'
Expand All @@ -31,4 +34,4 @@ before_script:
- composer update

script:
- phpunit
- vendor/bin/phpunit
44 changes: 22 additions & 22 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ parameters:
lolautruche_payline.notification_route: lolautruche_payline_notification

services:
_defaults:
autowire: true
autoconfigure: true
public: false

# Set PaylineSDK as a service.
lolautruche_payline.sdk:
class: Payline\PaylineSDK
Payline\PaylineSDK:
arguments:
- "%lolautruche_payline.merchant_id%"
- "%lolautruche_payline.access_key%"
Expand All @@ -29,26 +33,22 @@ services:
- "%lolautruche_payline.environment%"
- "%kernel.logs_dir%/"
- "%lolautruche_payline.log_verbosity%"
public: false

lolautruche_payline.gateway:
class: Lolautruche\PaylineBundle\Payline\Payline
arguments:
- "@lolautruche_payline.sdk"
- "@event_dispatcher"
- "%lolautruche_payline.default_currency%"
- "@=service('router').generate(parameter('lolautruche_payline.return_route'), [], 0)"
- "@=service('router').generate(parameter('lolautruche_payline.cancel_route'), [], 0)"
- "@=service('router').generate(parameter('lolautruche_payline.notification_route'), [], 0)"
- "%lolautruche_payline.default_contract_number%"
lolautruche_payline.sdk: '@Payline\PaylineSDK'

payline:
alias: lolautruche_payline.gateway
Lolautruche\PaylineBundle\Payline\Payline:
$defaultCurrency: "%lolautruche_payline.default_currency%"
$defaultReturnUrl: "@=service('router').generate(parameter('lolautruche_payline.return_route'), [], 0)"
$defaultCancelUrl: "@=service('router').generate(parameter('lolautruche_payline.cancel_route'), [], 0)"
$defaultNotificationUrl: "@=service('router').generate(parameter('lolautruche_payline.notification_route'), [], 0)"
$defaultContractNumber: "%lolautruche_payline.default_contract_number%"

lolautruche_payline.controller:
class: Lolautruche\PaylineBundle\Controller\PaylineController
arguments:
- "@event_dispatcher"
- "@lolautruche_payline.gateway"
- "@=service('router').generate(parameter('lolautruche_payline.default_confirmation_route'), [], 0)"
- "@=service('router').generate(parameter('lolautruche_payline.default_error_route'), [], 0)"
lolautruche_payline.gateway: '@Lolautruche\PaylineBundle\Payline\Payline'
payline: '@Lolautruche\PaylineBundle\Payline\Payline'
Lolautruche\PaylineBundle\Payline\WebGatewayInterface: '@Lolautruche\PaylineBundle\Payline\Payline'

Lolautruche\PaylineBundle\Controller\PaylineController:
$defaultConfirmationUrl: "@=service('router').generate(parameter('lolautruche_payline.default_confirmation_route'), [], 0)"
$defaultErrorUrl: "@=service('router').generate(parameter('lolautruche_payline.default_error_route'), [], 0)"

lolautruche_payline.controller: '@Lolautruche\PaylineBundle\Controller\PaylineController'
10 changes: 6 additions & 4 deletions Tests/Controller/PaylineControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
use Lolautruche\PaylineBundle\Event\PaylineEvents;
use Lolautruche\PaylineBundle\Event\PaymentNotificationEvent;
use Lolautruche\PaylineBundle\Payline\PaylineResult;
use PHPUnit_Framework_TestCase;
use Lolautruche\PaylineBundle\Payline\WebGatewayInterface;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class PaylineControllerTest extends PHPUnit_Framework_TestCase
class PaylineControllerTest extends TestCase
{
/**
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject
Expand All @@ -39,8 +41,8 @@ class PaylineControllerTest extends PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
$this->eventDispatcher = $this->createMock('\Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->paylineGateway = $this->createMock('\Lolautruche\PaylineBundle\Payline\WebGatewayInterface');
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->paylineGateway = $this->createMock(WebGatewayInterface::class);
}

public function testPaymentNotificationAction()
Expand Down
4 changes: 2 additions & 2 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use Lolautruche\PaylineBundle\DependencyInjection\Configuration;
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use Payline\PaylineSDK;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class ConfigurationTest extends PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
use ConfigurationTestCaseTrait;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Event/PaymentNotificationEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

use Lolautruche\PaylineBundle\Event\PaymentNotificationEvent;
use Lolautruche\PaylineBundle\Payline\PaylineResult;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Response;

class PaymentNotificationEventTest extends PHPUnit_Framework_TestCase
class PaymentNotificationEventTest extends TestCase
{
public function testConstruct()
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/Event/ResultEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

use Lolautruche\PaylineBundle\Event\ResultEvent;
use Lolautruche\PaylineBundle\Payline\PaylineResult;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class ResultEventTest extends PHPUnit_Framework_TestCase
class ResultEventTest extends TestCase
{
public function testConstruct()
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/Payline/PaylineResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace Lolautruche\PaylineBundle\Tests\Payline;

use Lolautruche\PaylineBundle\Payline\PaylineResult;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class PaylineResultTest extends PHPUnit_Framework_TestCase
class PaylineResultTest extends TestCase
{
public function testGetResultHash()
{
Expand Down
10 changes: 6 additions & 4 deletions Tests/Payline/PaylineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
use Lolautruche\PaylineBundle\Payline\Payline;
use Lolautruche\PaylineBundle\Payline\PaylineResult;
use Lolautruche\PaylineBundle\Payline\WebTransaction;
use PHPUnit_Framework_TestCase;
use Payline\PaylineSDK;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class PaylineTest extends PHPUnit_Framework_TestCase
class PaylineTest extends TestCase
{
/**
* @var \Payline\PaylineSDK|\PHPUnit_Framework_MockObject_MockObject
Expand All @@ -38,8 +40,8 @@ class PaylineTest extends PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
$this->sdk = $this->createMock('\Payline\PaylineSDK');
$this->eventDispatcher = $this->createMock('\Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->sdk = $this->createMock(PaylineSDK::class);
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
}

public function testGetPaylineSdk()
Expand Down
4 changes: 2 additions & 2 deletions Tests/Payline/WebTransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

use DateTime;
use Lolautruche\PaylineBundle\Payline\WebTransaction;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class WebTransactionTest extends PHPUnit_Framework_TestCase
class WebTransactionTest extends TestCase
{
public function testConstructor()
{
Expand Down
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@
"name": "lolautruche/payline-bundle",
"description": "Symfony integration for Payline payment system",
"license": "MIT",
"type": "symfony-bundle",
"authors": [
{
"name": "Jérôme Vieilledent",
"email": "lolautruche@gmail.com"
}
],
"require": {
"php": "~5.4|~7.0",
"php": "^5.5.9|>=7.0.8",
"ext-soap": "*",
"monext/payline-sdk": "^4.45",
"symfony/symfony": "^2.7.10|^3.0.3|^4.0"
"monext/payline-sdk": "^4.59",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/expression-language": "^3.4|^4.0",
"symfony/property-access": "^3.4|^4.0"
},
"autoload" : {
"psr-4" : {
"Lolautruche\\PaylineBundle\\" : ""
}
},
"require-dev": {
"phpunit/phpunit": "^5.3",
"matthiasnoback/symfony-config-test": "^1.4",
"matthiasnoback/symfony-dependency-injection-test": "^0.7.6"
"phpunit/phpunit": "^6.5",
"matthiasnoback/symfony-config-test": "^3.1.1",
"matthiasnoback/symfony-dependency-injection-test": "^2.3.1"
}
}

0 comments on commit a891d5f

Please sign in to comment.