From 4a7f1059667a0d1b670a3a87d05227efc40dfd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Vil=C3=A0?= Date: Sun, 22 Oct 2023 13:45:12 +0200 Subject: [PATCH 1/2] wip --- .github/workflows/ci.yml | 7 +- .gitignore | 8 +- .php-cs-fixer.php | 21 + composer.json | 35 +- composer.lock | 1751 -------------------------------------- phpunit.xml.dist | 40 +- src/Sermepa/Tpv/Tpv.php | 117 ++- tests/TpvTest.php | 163 ++-- 8 files changed, 227 insertions(+), 1915 deletions(-) create mode 100644 .php-cs-fixer.php delete mode 100644 composer.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8df049..74b5e56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ name: Run Tests on: + pull_request: push: branches: - master @@ -12,13 +13,13 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ["8.2","8.1","8.0", "7.4", "7.3"] + php-versions: ["8.3","8.2","8.1"] dependency-stability: ["prefer-stable"] name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install PHP versions uses: shivammathur/setup-php@v2 with: @@ -45,4 +46,4 @@ jobs: env: SESSION_DRIVER: array - run: vendor/bin/phpunit --testdox + run: composer test diff --git a/.gitignore b/.gitignore index 2082bd0..d475046 100644 --- a/.gitignore +++ b/.gitignore @@ -11,11 +11,13 @@ Thumbs.db .idea # PHPUnit -/.phpunit.cache -.phpunit.result.cache +*.cache phpunit.xml vendor docker docker-compose.yml -.env \ No newline at end of file +.env +composer.lock +clover.xml +junit-logfile.xml diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..2543360 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,21 @@ +exclude('vendor') + ->in(__DIR__) +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'static_lambda' => true, + 'void_return' => true, + 'ternary_to_null_coalescing' => true, + 'visibility_required' => true, + ]) + ->setFinder($finder) +; diff --git a/composer.json b/composer.json index b56e044..63ab33f 100755 --- a/composer.json +++ b/composer.json @@ -1,9 +1,16 @@ { "name": "sermepa/sermepa", "description": "Pasarela de pago Redsys, Sermepa", - "keywords": ["sermepa", "payment", "pasarela", "lacaixa", "sabadell", "redsys"], - "homepage": "https://github.com/ssheduardo/sermepa", "license": "MIT", + "keywords": [ + "sermepa", + "payment", + "pasarela", + "lacaixa", + "sabadell", + "bbva", + "redsys" + ], "authors": [ { "name": "Eduardo D", @@ -11,16 +18,32 @@ "homepage": "http://ubublog.com/" } ], + "homepage": "https://github.com/ssheduardo/sermepa", "require": { - "php": "^7.1.3|^7.2.5|^8.0|^8.1|^8.2" + "php": "^8.1" }, "require-dev": { - "phpunit/phpunit": "^7.0|^8.5.8|^9.3.3" + "friendsofphp/php-cs-fixer": "^3.0", + "phpunit/phpunit": "^10.0" }, + "minimum-stability": "stable", "autoload": { "psr-4": { "Sermepa\\Tpv\\": "src/Sermepa/Tpv/" } }, - "minimum-stability": "stable" -} \ No newline at end of file + "autoload-dev": { + "psr-4": { + "Sermepa\\Tests\\": "tests/" + } + }, + "scripts": { + "fix": [ + "@php ./vendor/bin/php-cs-fixer fix --allow-risky=yes" + ], + "test": [ + "@php ./vendor/bin/php-cs-fixer check --allow-risky=yes", + "@php ./vendor/bin/phpunit --testdox" + ] + } +} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index d705ed5..0000000 --- a/composer.lock +++ /dev/null @@ -1,1751 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "ae6ca8fe921ef59721a5006ffb2fd09b", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2022-03-03T13:19:32+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.15.3", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" - }, - "time": "2023-01-16T22:05:37+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.24", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-01-26T08:26:55+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.6.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1 || ^2", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.6-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2023-02-04T13:37:15+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T12:41:17+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:10:38+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:03:51+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T06:03:37+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-02-14T08:28:10+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" - }, - { - "name": "sebastian/type", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:13:03+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.1.3|^7.2.5|^8.0|^8.1|^8.2" - }, - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 47e0946..c334d69 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,30 @@ - - - - - ./src - - - - - ./tests - - + + + + + + + + + + + + ./tests + + + + + ./src + + diff --git a/src/Sermepa/Tpv/Tpv.php b/src/Sermepa/Tpv/Tpv.php index eb03763..995944e 100644 --- a/src/Sermepa/Tpv/Tpv.php +++ b/src/Sermepa/Tpv/Tpv.php @@ -9,9 +9,9 @@ */ class Tpv { - CONST TIMEOUT = 10; - CONST READ_TIMEOUT = 120; - CONST SSLVERSION_TLSv1_2 = 6; + public const TIMEOUT = 10; + public const READ_TIMEOUT = 120; + public const SSLVERSION_TLSv1_2 = 6; protected $_setEnvironment; protected $_setNameForm; @@ -32,7 +32,7 @@ public function __construct() { $this->setEnvironment(); - $this->_setParameters = array(); + $this->_setParameters = []; $this->_setVersion = 'HMAC_SHA256_V1'; $this->_setNameForm = 'redsys_form'; $this->_setIdForm = 'redsys_form'; @@ -139,7 +139,7 @@ public function setSumtotal($sumTotal) */ public function setChargeExpiryDate($date) { - if ( ! $this->isValidDate($date) ) { + if (! $this->isValidDate($date)) { throw new TpvException('Date is not valid.'); } @@ -149,20 +149,20 @@ public function setChargeExpiryDate($date) } /** - * Set Date frecuency (required for recurring payment) + * Set Date frequency (required for recurring payment) * - * @param $dateFrecuency + * @param $dateFrequency * * @return $this * @throws TpvException */ - public function setDateFrecuency($dateFrecuency) + public function setDateFrequency($dateFrequency): self { - if ( !is_numeric($dateFrecuency) || (strlen($dateFrecuency) < 1 || strlen($dateFrecuency) > 5) ) { - throw new TpvException('Date frecuency is not valid.'); + if (!is_numeric($dateFrequency) || (strlen($dateFrequency) < 1 || strlen($dateFrequency) > 5)) { + throw new TpvException('Date frequency is not valid.'); } - $this->_setParameters['DS_MERCHANT_DATEFRECUENCY'] = $dateFrecuency; + $this->_setParameters['DS_MERCHANT_DATEFRECUENCY'] = $dateFrequency; return $this; } @@ -177,7 +177,7 @@ public function setDateFrecuency($dateFrecuency) * @return $this * @throws TpvException */ - public function setOrder($order='') + public function setOrder($order = '') { $order = trim($order); if (strlen($order) <= 3 || strlen($order) > 12 || !preg_match('/^[\w\.]+$/', substr($order, 0, 4))) { @@ -226,7 +226,7 @@ public function getOrderNotification($parameters) * @return $this * @throws TpvException */ - public function setMerchantcode($fuc='') + public function setMerchantcode($fuc = '') { if ($this->isEmpty($fuc)) { throw new TpvException('Please add Fuc'); @@ -440,7 +440,7 @@ public function setEnvironment($environment = 'test') } elseif ($environment === 'restLive' || $environment === 'manageRequestRestLive') { //Rest Live $this->_setEnvironment = 'https://sis.redsys.es/sis/rest/trataPeticionREST'; - } elseif ($environment === 'restTest' || $environment === 'manageRequestRestTest' ) { + } elseif ($environment === 'restTest' || $environment === 'manageRequestRestTest') { //Rest Test $this->_setEnvironment = 'https://sis-t.redsys.es:25443/sis/rest/trataPeticionREST'; } elseif ($environment === 'startRequestRestLive') { @@ -516,13 +516,13 @@ public function getEnvironment() * @param string $env test or live * @return string string path javascript */ - public static function getJsPath($environment = 'test'){ - if($environment == 'test'){ + public static function getJsPath($environment = 'test') + { + if($environment == 'test') { return 'https://sis-t.redsys.es:25443/sis/NC/sandbox/redsysV2.js'; - } - elseif($environment == 'live'){ + } elseif($environment == 'live') { return 'https://sis.redsys.es/sis/NC/redsysV2.js'; - }else{ + } else { throw new TpvException('Add test or live'); } } @@ -536,7 +536,7 @@ public static function getJsPath($environment = 'test'){ * @return $this * @throws Exception */ - public function setMerchantData($merchantdata='') + public function setMerchantData($merchantdata = '') { if ($this->isEmpty($merchantdata)) { throw new TpvException('Add merchant data'); @@ -607,10 +607,10 @@ public function setTradeName($tradename = '') /** * Payment type * - * @param string $method + * @param string $method * [ * T o C = Sólo Tarjeta (mostrará sólo el formulario para datos de tarjeta) - * R = Pago por Transferencia, + * R = Pago por Transferencia, * D = Domiciliación * z = Bizum * p = PayPal @@ -643,7 +643,7 @@ public function setMethod($method = 'C') * @return $this * @throws TpvException */ - public function setPan($pan=0) + public function setPan($pan = 0) { if (intval($pan) === 0) { throw new TpvException('Pan not valid'); @@ -663,9 +663,9 @@ public function setPan($pan=0) * @return $this * @throws TpvException */ - public function setExpiryDate($expirydate='') + public function setExpiryDate($expirydate = '') { - if ( !$this->isExpiryDate($expirydate) ) { + if (!$this->isExpiryDate($expirydate)) { throw new TpvException('Expire date is not valid'); } $this->_setParameters['DS_MERCHANT_EXPIRYDATE'] = $expirydate; @@ -681,7 +681,7 @@ public function setExpiryDate($expirydate='') * @throws TpvException */ - public function setParameters($parameters=[]) + public function setParameters($parameters = []) { if(!is_array($parameters)) { throw new TpvException('Parameters is not an array'); @@ -689,7 +689,7 @@ public function setParameters($parameters=[]) $keys = array_keys($parameters); - if(array_keys($keys) === $keys ) { + if(array_keys($keys) === $keys) { throw new TpvException('Parameters is not an array associative'); } @@ -706,7 +706,7 @@ public function setParameters($parameters=[]) * @return $this * @throws TpvException */ - public function setCVV2($cvv2=0) + public function setCVV2($cvv2 = 0) { if (intval($cvv2) === 0) { throw new TpvException('CVV2 is not valid'); @@ -787,7 +787,7 @@ public function setAttributesSubmit( public function executeRedirection($return = false) { $html = $this->createForm(); - $html .= ''; + $html .= ''; if (!$return) { echo $html; @@ -806,11 +806,11 @@ public function executeRedirection($return = false) public function createForm() { $form = ' -
- - - - _setStyleSubmit != '' ? ' style="'.$this->_setStyleSubmit.'"' : '').' '.($this->_setClassSubmit != '' ? ' class="'.$this->_setClassSubmit.'"' : '').'> + + + + + _setStyleSubmit != '' ? ' style="' . $this->_setStyleSubmit . '"' : '') . ' ' . ($this->_setClassSubmit != '' ? ' class="' . $this->_setClassSubmit . '"' : '') . '>
'; @@ -828,30 +828,29 @@ public function send() $jsonCode = json_encode($data); - $rest = curl_init (); - curl_setopt ($rest, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); - curl_setopt ( $rest, CURLOPT_URL, $this->_setEnvironment ); - curl_setopt ( $rest, CURLOPT_CONNECTTIMEOUT, self::TIMEOUT ); - curl_setopt ( $rest, CURLOPT_TIMEOUT, self::READ_TIMEOUT ); - curl_setopt ( $rest, CURLOPT_RETURNTRANSFER, true ); - curl_setopt ( $rest, CURLOPT_SSL_VERIFYHOST, 0 ); - curl_setopt ( $rest, CURLOPT_SSL_VERIFYPEER, 0 ); - curl_setopt ( $rest, CURLOPT_SSLVERSION, self::SSLVERSION_TLSv1_2 ); - curl_setopt ( $rest, CURLOPT_POST, true ); - curl_setopt ( $rest, CURLOPT_POSTFIELDS, $jsonCode ); - - $tmp = curl_exec ( $rest ); - $httpCode=curl_getinfo($rest,CURLINFO_HTTP_CODE); - - if($tmp !== false && $httpCode==200){ - $result=$tmp; - } - else{ - $strError="Request failure ".(($httpCode!=200)?"[HttpCode: '".$httpCode."']":"").((curl_error($rest))?" [Error: '".curl_error($rest)."']":""); + $rest = curl_init(); + curl_setopt($rest, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); + curl_setopt($rest, CURLOPT_URL, $this->_setEnvironment); + curl_setopt($rest, CURLOPT_CONNECTTIMEOUT, self::TIMEOUT); + curl_setopt($rest, CURLOPT_TIMEOUT, self::READ_TIMEOUT); + curl_setopt($rest, CURLOPT_RETURNTRANSFER, true); + curl_setopt($rest, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($rest, CURLOPT_SSLVERSION, self::SSLVERSION_TLSv1_2); + curl_setopt($rest, CURLOPT_POST, true); + curl_setopt($rest, CURLOPT_POSTFIELDS, $jsonCode); + + $tmp = curl_exec($rest); + $httpCode = curl_getinfo($rest, CURLINFO_HTTP_CODE); + + if($tmp !== false && $httpCode == 200) { + $result = $tmp; + } else { + $strError = "Request failure " . (($httpCode != 200) ? "[HttpCode: '" . $httpCode . "']" : "") . ((curl_error($rest)) ? " [Error: '" . curl_error($rest) . "']" : ""); exit($strError); } - curl_close( $rest ); + curl_close($rest); return $result; } @@ -974,7 +973,7 @@ public function setMerchantCofType($value) public function setMerchantCofTxnid($txid) { if($txid) { - $this->_setParameters['DS_MERCHANT_COF_TXNID'] = $txid; + $this->_setParameters['DS_MERCHANT_COF_TXNID'] = $txid; } return $this; } @@ -1064,7 +1063,7 @@ protected function isEmpty($value) * @param string $expirydate * @return boolean */ - protected function isExpiryDate($expirydate='') + protected function isExpiryDate($expirydate = '') { return (strlen(trim($expirydate)) === 4 && is_numeric($expirydate)); } @@ -1075,9 +1074,9 @@ protected function isExpiryDate($expirydate='') * @param string $order * @return boolean */ - protected function isValidOrder($order='') + protected function isValidOrder($order = '') { - return ( strlen($order) >= 4 && strlen($order) <= 12 && preg_match('/^[\w\.]+$/', substr($order, 0, 4)) )?true:false; + return (strlen($order) >= 4 && strlen($order) <= 12 && preg_match('/^[\w\.]+$/', substr($order, 0, 4))) ? true : false; } diff --git a/tests/TpvTest.php b/tests/TpvTest.php index a4f221e..c041250 100644 --- a/tests/TpvTest.php +++ b/tests/TpvTest.php @@ -1,21 +1,22 @@ setIdentifier(); $this->assertContains('REQUIRED', $redsys->getParameters()); } - public function booleanProvider() + public static function booleanProvider(): array { return [ [true], @@ -27,15 +28,15 @@ public function booleanProvider() * @test * @dataProvider booleanProvider */ - public function merchant_direct_payment_return_false_or_true($boolean) + public function merchant_direct_payment_return_false_or_true($boolean): void { $redsys = new Tpv(); $redsys->setMerchantDirectPayment($boolean); $ds = $redsys->getParameters(); - $this->assertIsBool( $ds['DS_MERCHANT_DIRECTPAYMENT']); + $this->assertIsBool($ds['DS_MERCHANT_DIRECTPAYMENT']); } - public function amountProvider() + public static function amountProvider(): array { return [ [0, '00,00'], @@ -52,7 +53,7 @@ public function amountProvider() * @test * @dataProvider amountProvider */ - public function amount_is_valid($correctAmount, $amount) + public function amount_is_valid($correctAmount, $amount): void { $redsys = new Tpv(); $redsys->setAmount($amount); @@ -66,7 +67,7 @@ public function amount_is_valid($correctAmount, $amount) * @test * @dataProvider amountProvider */ - public function sum_total_is_valid($correctAmount, $amount) + public function sum_total_is_valid($correctAmount, $amount): void { $redsys = new Tpv(); $redsys->setSumTotal($amount); @@ -78,16 +79,16 @@ public function sum_total_is_valid($correctAmount, $amount) /** * @test */ - public function throw_sum_total_is_invalid_number() + public function throw_sum_total_is_invalid_number(): void { $this->expectExceptionMessage("Sum total must be greater than or equal to 0."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setSumTotal(-1); } - public function dateFrecuencyProvider() + public static function dateFrequencyProvider(): array { return [ [3], @@ -99,18 +100,18 @@ public function dateFrecuencyProvider() /** * @test - * @dataProvider dateFrecuencyProvider + * @dataProvider dateFrequencyProvider */ - public function date_frecuency_is_valid($dateFrecuency) + public function date_frequency_is_valid($dateFrequency): void { $redsys = new Tpv(); - $redsys->setDateFrecuency($dateFrecuency); + $redsys->setDateFrequency($dateFrequency); $parameters = $redsys->getParameters(); $this->assertArrayHasKey('DS_MERCHANT_DATEFRECUENCY', $parameters); } - public function invalidDateFrecuencyProvider() + public static function invalidDateFrequencyProvider(): array { return [ [666666], @@ -123,20 +124,20 @@ public function invalidDateFrecuencyProvider() /** * @test - * @dataProvider invalidDateFrecuencyProvider + * @dataProvider invalidDateFrequencyProvider */ - public function throw_date_frecuency_is_invalid($dateFrecuency) + public function throw_date_frequency_is_invalid($dateFrequency): void { - $this->expectExceptionMessage("Date frecuency is not valid."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectExceptionMessage("Date frequency is not valid."); + $this->expectException(TpvException::class); $redsys = new Tpv(); - $redsys->setDateFrecuency($dateFrecuency); + $redsys->setDateFrequency($dateFrequency); } /** * @test */ - public function charge_expiry_date_is_valid() + public function charge_expiry_date_is_valid(): void { $redsys = new Tpv(); $redsys->setChargeExpiryDate('2025-03-04'); @@ -145,7 +146,7 @@ public function charge_expiry_date_is_valid() $this->assertArrayHasKey('DS_MERCHANT_CHARGEEXPIRYDATE', $parameters); } - public function invalidChargeExpiryDateProvider() + public static function invalidChargeExpiryDateProvider(): array { return [ ['2024-13-04'], @@ -162,16 +163,16 @@ public function invalidChargeExpiryDateProvider() * @test * @dataProvider invalidChargeExpiryDateProvider */ - public function throw_charge_expiry_date_is_invalid($date) + public function throw_charge_expiry_date_is_invalid($date): void { $this->expectExceptionMessage("Date is not valid."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setChargeExpiryDate($date); } - public function invalidOrderNumberProvider() + public static function invalidOrderNumberProvider(): array { return [ ['A-001'], @@ -190,16 +191,16 @@ public function invalidOrderNumberProvider() * @test * @dataProvider invalidOrderNumberProvider */ - public function throw_when_order_is_invalid($orderNumber) + public function throw_when_order_is_invalid($orderNumber): void { $this->expectExceptionMessage("Order id must be a 4 digit string at least, maximum 12 characters."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setOrder($orderNumber); } - public function orderNumberProvider() + public static function orderNumberProvider(): array { return [ [100253508], @@ -218,7 +219,7 @@ public function orderNumberProvider() * @test * @dataProvider orderNumberProvider */ - public function should_validate_an_order_number($order) + public function should_validate_an_order_number($order): void { $redsys = new Tpv(); $redsys->setOrder($order); @@ -229,10 +230,10 @@ public function should_validate_an_order_number($order) /** * @test */ - public function throw_merchant_code_is_empty() + public function throw_merchant_code_is_empty(): void { $this->expectExceptionMessage("Please add Fuc"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setMerchantcode(); } @@ -240,10 +241,10 @@ public function throw_merchant_code_is_empty() /** * @test */ - public function throw_currency_is_not_supported() + public function throw_currency_is_not_supported(): void { $this->expectExceptionMessage("Currency is not valid"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setCurrency('csm'); } @@ -251,10 +252,10 @@ public function throw_currency_is_not_supported() /** * @test */ - public function throw_transaction_type_is_empty() + public function throw_transaction_type_is_empty(): void { $this->expectExceptionMessage("Please add transaction type"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setTransactiontype(''); } @@ -263,10 +264,10 @@ public function throw_transaction_type_is_empty() /** * @test */ - public function throw_terminal_is_invalid_number() + public function throw_terminal_is_invalid_number(): void { $this->expectExceptionMessage("Terminal is not valid."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setTerminal('0'); } @@ -274,17 +275,17 @@ public function throw_terminal_is_invalid_number() /** * @test */ - public function throw_environment_is_not_test_or_live() + public function throw_environment_is_not_test_or_live(): void { $this->expectExceptionMessage("Add test or live"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setEnvironment('production'); } - public function SearchingFormProvider() + public static function searchingFormProvider(): array { return [ ['Ds_MerchantParameters'], @@ -297,24 +298,24 @@ public function SearchingFormProvider() /** * @test - * @dataProvider SearchingFormProvider + * @dataProvider searchingFormProvider */ - public function check_if_form_create_inputs_with_parameters($search) + public function check_if_form_create_inputs_with_parameters($search): void { $redsys = new Tpv(); $form = $redsys->createForm(); - $this->assertStringContainsString($search,$form); + $this->assertStringContainsString($search, $form); } /** * @test * */ - public function when_set_all_parameters_should_obtain_all_ds_merchant_valid() + public function when_set_all_parameters_should_obtain_all_ds_merchant_valid(): void { $redsys = new Tpv(); $redsys->setEnvironment('test') - ->setAmount(rand(10,600)) + ->setAmount(rand(10, 600)) ->setOrder(time()) ->setMerchantcode('999008881') ->setCurrency('978') @@ -344,16 +345,16 @@ public function when_set_all_parameters_should_obtain_all_ds_merchant_valid() /** * @test */ - public function throw_version_is_empty() + public function throw_version_is_empty(): void { $this->expectExceptionMessage("Please add version."); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setVersion(); } - public function urlTpvProvider() + public static function urlTpvProvider(): array { return [ ['live', 'https://sis.redsys.es/sis/realizarPago'], @@ -369,7 +370,7 @@ public function urlTpvProvider() * @test * @dataProvider urlTpvProvider */ - public function check_if_url_of_tpv_is_test_or_live($environment, $url) + public function check_if_url_of_tpv_is_test_or_live($environment, $url): void { $redsys = new Tpv(); $redsys->setEnvironment($environment); @@ -380,11 +381,11 @@ public function check_if_url_of_tpv_is_test_or_live($environment, $url) /** * @test */ - public function force_to_send_the_form_with_javascript() + public function force_to_send_the_form_with_javascript(): void { $redsys = new Tpv(); - $redsys->setNameForm('custom_form_'.date('His')); - $js = 'document.forms["'.$redsys->getNameForm().'"].submit();'; + $redsys->setNameForm('custom_form_' . date('His')); + $js = 'document.forms["' . $redsys->getNameForm() . '"].submit();'; $redirect = $redsys->executeRedirection(true); @@ -394,10 +395,10 @@ public function force_to_send_the_form_with_javascript() /** * @test */ - public function throw_merchant_data_is_empty() + public function throw_merchant_data_is_empty(): void { $this->expectExceptionMessage("Add merchant data"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setMerchantData(); } @@ -405,10 +406,10 @@ public function throw_merchant_data_is_empty() /** * @test */ - public function throw_product_description_is_empty() + public function throw_product_description_is_empty(): void { $this->expectExceptionMessage("Add product description"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setProductDescription(); } @@ -416,10 +417,10 @@ public function throw_product_description_is_empty() /** * @test */ - public function throw_titular_is_empty() + public function throw_titular_is_empty(): void { $this->expectExceptionMessage("Add name for the user"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setTitular(); } @@ -427,10 +428,10 @@ public function throw_titular_is_empty() /** * @test */ - public function throw_trade_name_is_empty() + public function throw_trade_name_is_empty(): void { $this->expectExceptionMessage("Add name for Trade name"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setTradeName(); } @@ -438,15 +439,15 @@ public function throw_trade_name_is_empty() /** * @test */ - public function throw_pan_is_invalid() + public function throw_pan_is_invalid(): void { $this->expectExceptionMessage("Pan not valid"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setPan(0); } - public function invalidExpiryDateProvider() + public static function invalidExpiryDateProvider(): array { return [ ['23233'], @@ -465,10 +466,10 @@ public function invalidExpiryDateProvider() * @test * @dataProvider invalidExpiryDateProvider */ - public function throw_expiry_date_is_invalid($expiry_date) + public function throw_expiry_date_is_invalid($expiry_date): void { $this->expectExceptionMessage("Expire date is not valid"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setExpiryDate($expiry_date); } @@ -476,7 +477,7 @@ public function throw_expiry_date_is_invalid($expiry_date) /** * @test */ - public function expiry_date_is_number_and_has_four_characters() + public function expiry_date_is_number_and_has_four_characters(): void { $redsys = new Tpv(); $redsys->setExpiryDate(2012); @@ -487,16 +488,16 @@ public function expiry_date_is_number_and_has_four_characters() /** * @test */ - public function throw_cvv2_is_invalid() + public function throw_cvv2_is_invalid(): void { $this->expectExceptionMessage("CVV2 is not valid"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setCVV2(); } - public function invalidParameters() + public static function invalidParameters(): array { return [ ['23233'], @@ -515,14 +516,14 @@ public function invalidParameters() * @dataProvider invalidParameters */ - public function throw_parameters_is_not_an_array($parameters) + public function throw_parameters_is_not_an_array($parameters): void { $this->expectExceptionMessage("Parameters is not an array associative"); $this->expectExceptionMessage("Parameters is not an array"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); - $redsys->setParameters($parameters); + $redsys->setParameters($parameters); } @@ -530,8 +531,8 @@ public function throw_parameters_is_not_an_array($parameters) * @test */ - public function set_new_parameters() - { + public function set_new_parameters(): void + { $parameters = ['DS_MERCHANT_COF_INI' => 'S', 'DS_MERCHANT_COF_TYPE' => 'R']; $redsys = new Tpv(); $redsys->setParameters($parameters); @@ -539,9 +540,9 @@ public function set_new_parameters() $this->assertArrayHasKey('DS_MERCHANT_COF_INI', $parameters); $this->assertArrayHasKey('DS_MERCHANT_COF_TYPE', $parameters); - } + } - public function invalidSetMethod() + public static function invalidSetMethod(): array { return [ ['V'], @@ -556,15 +557,15 @@ public function invalidSetMethod() * @test * @dataProvider invalidSetMethod */ - public function throw_when_set_method_is_invalid($method) + public function throw_when_set_method_is_invalid($method): void { $this->expectExceptionMessage("Pay method is not valid"); - $this->expectException(\Sermepa\Tpv\TpvException::class); + $this->expectException(TpvException::class); $redsys = new Tpv(); $redsys->setMethod($method); } - public function methodsProvider() + public static function methodsProvider(): array { return [ ['T'], @@ -582,7 +583,7 @@ public function methodsProvider() * @test * @dataProvider methodsProvider */ - public function should_validate_a_method($method) + public function should_validate_a_method($method): void { $redsys = new Tpv(); $redsys->setMethod($method); From 592b3ba033566110666177fe75b735a9d540993c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Vil=C3=A0?= Date: Mon, 6 Nov 2023 17:55:09 +0100 Subject: [PATCH 2/2] wip --- .github/workflows/ci.yml | 4 ++++ composer.json | 4 +++- src/Sermepa/Tpv/Tpv.php | 5 +++-- tests/TpvTest.php | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74b5e56..9831076 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,10 @@ jobs: - name: PHP Version run: php --version + - name: Execute static analysis tests + if: matrix.php-versions == '8.2' + run: composer test-static + # Code quality - name: Execute tests (Unit and Feature tests) via PHPUnit # Set environment diff --git a/composer.json b/composer.json index 63ab33f..8a9ea4b 100755 --- a/composer.json +++ b/composer.json @@ -41,8 +41,10 @@ "fix": [ "@php ./vendor/bin/php-cs-fixer fix --allow-risky=yes" ], + "test-static": [ + "@php ./vendor/bin/php-cs-fixer check --allow-risky=yes" + ], "test": [ - "@php ./vendor/bin/php-cs-fixer check --allow-risky=yes", "@php ./vendor/bin/phpunit --testdox" ] } diff --git a/src/Sermepa/Tpv/Tpv.php b/src/Sermepa/Tpv/Tpv.php index 38320e3..4bc923b 100644 --- a/src/Sermepa/Tpv/Tpv.php +++ b/src/Sermepa/Tpv/Tpv.php @@ -139,7 +139,7 @@ public function setSumtotal($sumTotal) */ public function setChargeExpiryDate($date) { - if (! $this->isValidDate($date)) { + if (!$this->isValidDate($date)) { throw new TpvException('Date is not valid.'); } @@ -517,7 +517,8 @@ public function getEnvironment() * @param string $version JavaScript file version: 2 or 3. * @return string JavaScript file path. */ - public static function getJsPath($environment = 'test', $version = '2'){ + public static function getJsPath($environment = 'test', $version = '2') + { // Stores the array of JavaScript file paths. static $jsPaths = [ diff --git a/tests/TpvTest.php b/tests/TpvTest.php index 00f860a..c44fab4 100644 --- a/tests/TpvTest.php +++ b/tests/TpvTest.php @@ -605,7 +605,7 @@ public function jsPathProvider() * @test * @dataProvider jsPathProvider */ - public function should_return_the_correct_js_path($environment, $version, $expectedPath) + public function should_return_the_correct_js_path($environment, $version, $expectedPath): void { $redsys = new Tpv(); $actualPath = $redsys->getJsPath($environment, $version); @@ -613,7 +613,7 @@ public function should_return_the_correct_js_path($environment, $version, $expec $this->assertEquals($expectedPath, $actualPath); } - public function invalidEnvironmentVersionPathJs() + public static function invalidEnvironmentVersionPathJs() { return [ ['test', '1'], @@ -633,7 +633,7 @@ public function invalidEnvironmentVersionPathJs() * @test * @dataProvider invalidEnvironmentVersionPathJs */ - public function throw_when_set_environment_or_version_is_invalid($environment, $version) + public function throw_when_set_environment_or_version_is_invalid($environment, $version): void { $this->expectExceptionMessage("Invalid environment or version"); $this->expectException(\Sermepa\Tpv\TpvException::class);