diff --git a/.travis.yml b/.travis.yml index 9c2efec..1f36d11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,9 @@ cache: - $HOME/.composer/cache php: - - 5.6 - - 7.0 + - 7.1 + - 7.2 + - 7.3 branches: only: @@ -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;' @@ -31,4 +34,4 @@ before_script: - composer update script: - - phpunit + - vendor/bin/phpunit diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 9b035ab..b0ca6fb 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -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%" @@ -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' diff --git a/Tests/Controller/PaylineControllerTest.php b/Tests/Controller/PaylineControllerTest.php index 1846a5d..8fedd9f 100644 --- a/Tests/Controller/PaylineControllerTest.php +++ b/Tests/Controller/PaylineControllerTest.php @@ -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 @@ -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() diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 205710e..84bfdf8 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -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; diff --git a/Tests/Event/PaymentNotificationEventTest.php b/Tests/Event/PaymentNotificationEventTest.php index 0c2c5ba..6e1f4c9 100644 --- a/Tests/Event/PaymentNotificationEventTest.php +++ b/Tests/Event/PaymentNotificationEventTest.php @@ -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() { diff --git a/Tests/Event/ResultEventTest.php b/Tests/Event/ResultEventTest.php index f0f1cda..e7321ad 100644 --- a/Tests/Event/ResultEventTest.php +++ b/Tests/Event/ResultEventTest.php @@ -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() { diff --git a/Tests/Payline/PaylineResultTest.php b/Tests/Payline/PaylineResultTest.php index 1244b9f..4fca925 100644 --- a/Tests/Payline/PaylineResultTest.php +++ b/Tests/Payline/PaylineResultTest.php @@ -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() { diff --git a/Tests/Payline/PaylineTest.php b/Tests/Payline/PaylineTest.php index 9d9b4c5..9b897f6 100644 --- a/Tests/Payline/PaylineTest.php +++ b/Tests/Payline/PaylineTest.php @@ -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 @@ -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() diff --git a/Tests/Payline/WebTransactionTest.php b/Tests/Payline/WebTransactionTest.php index 7c69c49..fa897e1 100644 --- a/Tests/Payline/WebTransactionTest.php +++ b/Tests/Payline/WebTransactionTest.php @@ -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() { diff --git a/composer.json b/composer.json index 77b0a58..7034cce 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "lolautruche/payline-bundle", "description": "Symfony integration for Payline payment system", "license": "MIT", + "type": "symfony-bundle", "authors": [ { "name": "Jérôme Vieilledent", @@ -9,10 +10,12 @@ } ], "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" : { @@ -20,8 +23,8 @@ } }, "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" } }