diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..856cde6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + + permissions: + contents: read + + strategy: + matrix: + symfony-version: ['4.4', '5.4'] + + name: PHP 7.4 - Symfony ${{ matrix.symfony-version }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + extensions: mbstring, xml, ctype, iconv + coverage: none + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + composer self-update + composer --version + composer require symfony/framework-bundle:${{ matrix.symfony-version }} --no-update + composer install --no-interaction --prefer-dist + + - name: Run test suite + run: vendor/bin/phpunit --configuration phpunit.xml.dist diff --git a/.gitignore b/.gitignore index 24c7d96..c5a8d84 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ composer.lock composer.phar phpunit.xml +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9fe794e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php - -php: - - 7.2 - - 7.3 - - 7.4 - -env: - - SYMFONY_VERSION="3.4" - - SYMFONY_VERSION="4.0" - - SYMFONY_VERSION="4.4" - -before_script: - - composer self-update - - composer --version - - composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update - - composer install -n --prefer-source - -script: phpunit --coverage-text --configuration phpunit.xml.dist diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index fd1aa02..12dd881 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -16,8 +16,8 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('omnipay'); + $treeBuilder = new TreeBuilder('omnipay'); + $rootNode = $treeBuilder->getRootNode(); $rootNode->children() ->arrayNode('log') ->addDefaultsIfNotSet() diff --git a/README.md b/README.md index 5996a47..508b970 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ -Xola OmnipayBundle [![Build status...](https://secure.travis-ci.org/xola/OmnipayBundle.png)](http://travis-ci.org/xola/OmnipayBundle) +Xola OmnipayBundle [![CI](https://github.com/xola/OmnipayBundle/workflows/CI/badge.svg)](https://github.com/xola/OmnipayBundle/actions) ================== This bundle integrates the [Omnipay payment processing library](https://github.com/adrianmacneil/omnipay) into -[Symfony2](http://symfony.com/). +[Symfony](http://symfony.com/). -This bundle supports Omnipay 3 +This bundle supports Omnipay 3 and requires PHP 7.4+ and Symfony 4.4+. + +Requirements +------------ +- PHP 7.4 or higher +- Symfony 4.4 or higher Installation ------------ @@ -17,8 +22,18 @@ To install via [Composer](http://getcomposer.org/), add the following to your `c } ``` -Add the bundle to your application kernel. +Add the bundle to your application kernel (Symfony 4+: this is done automatically via Symfony Flex). + +```php +// config/bundles.php (Symfony 4+) +return [ + // ... + Xola\OmnipayBundle\OmnipayBundle::class => ['all' => true], + // ... +]; +``` +For older Symfony versions: ```php // app/AppKernel.php public function registerBundles() diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 3c8c43e..6d31a41 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -1,9 +1,8 @@ -parameters: - omnipay.service.class: Xola\OmnipayBundle\Service\Omnipay - services: omnipay: - class: "%omnipay.service.class%" - arguments: [ "@service_container", "@logger" ] + class: Xola\OmnipayBundle\Service\Omnipay + arguments: + - '@service_container' + - '@logger' tags: - - { name: monolog.logger, channel: omnipay } + - { name: monolog.logger, channel: omnipay } diff --git a/composer.json b/composer.json index b9ef661..8f9bfb5 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "xola/omnipay-bundle", "type": "symfony-bundle", - "description": "Integrates Omnipay 3 with Symfony 2+", + "description": "Integrates Omnipay 3 with Symfony 4.4+ and 5.4+", "keywords": [ "omnipay", "payment", @@ -12,13 +12,16 @@ "homepage": "https://github.com/xola/OmnipayBundle", "license": "MIT", "require": { - "php": ">=7", - "symfony/framework-bundle": ">=2.1", + "php": "^7.4 || ^8.0", + "symfony/framework-bundle": "^4.4 || ^5.4", + "symfony/dependency-injection": "^4.4 || ^5.4", + "symfony/config": "^4.4 || ^5.4", + "symfony/http-kernel": "^4.4 || ^5.4", "league/omnipay": "^3.0", "php-http/logger-plugin": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^6", + "phpunit/phpunit": "^9.5", "omnipay/authorizenet": "^3.3", "omnipay/eway": "^3.0", "omnipay/mollie": "^5.2", @@ -28,7 +31,7 @@ "omnipay/securepay": "^3.0", "omnipay/stripe": "^3.1", "omnipay/worldpay": "^3.0", - "symfony/yaml": "^3.4" + "symfony/yaml": "^4.4 || ^5.4" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d0be232..f41c80f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,14 @@ -