From 0f7cd164d8f9905b584b721d8ce752388ef28f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 11 Dec 2018 15:02:25 +0100 Subject: [PATCH 01/24] ncu -u && npm install --- package-lock.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd4c86d..e8a5b1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wp-money", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -71,7 +71,7 @@ }, "async": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, @@ -134,7 +134,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -176,7 +176,7 @@ }, "colors": { "version": "1.1.2", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, @@ -362,7 +362,7 @@ "dependencies": { "grunt-cli": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", "dev": true, "requires": { @@ -879,7 +879,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -931,7 +931,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -990,7 +990,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -1174,7 +1174,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, From 15c14cae65f7ead4037b6330c28ec592a89f0bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sun, 16 Dec 2018 16:40:09 +0100 Subject: [PATCH 02/24] WordPress Coding Standards. --- tests/bootstrap.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6f8112b..073a41a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,6 +9,9 @@ require_once getenv( 'WP_PHPUNIT__DIR' ) . '/includes/functions.php'; +/** + * Manually load plugin. + */ function _manually_load_plugin() { require __DIR__ . '/../pronamic-money.php'; } From 7e4b2e1f5b7561853c86876963d8987d9eb3ba9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sun, 16 Dec 2018 19:15:30 +0100 Subject: [PATCH 03/24] Add Scrutinizer test coverage and build failure condition config. --- .scrutinizer.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 37d0b6d..18894ae 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,3 +1,22 @@ +build: + environment: + variables: + WP_TESTS_DB_NAME: 'wp_phpunit_tests' + WP_TESTS_DB_USER: 'root' + WP_TESTS_DB_PASS: '' + WP_TESTS_DB_HOST: 'localhost' + project_setup: + before: + - mysql -e "CREATE DATABASE wp_phpunit_tests" + nodes: + coverage: + tests: + override: + - command: ./vendor/bin/phpunit + coverage: + file: build/logs/clover.xml + format: clover + checks: php: coding_standard: @@ -5,6 +24,9 @@ checks: code_rating: true duplication: true +build_failure_conditions: + - 'issues.label("bug").exists' + coding_style: php: indentation: From f101464b074e94d7bd3a7a1114d2b0bee61ced56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Fri, 4 Jan 2019 16:34:06 +0100 Subject: [PATCH 04/24] Happy 2019. --- pronamic-money.php | 2 +- resources/currencies.php | 2 +- src/Currencies.php | 2 +- src/Currency.php | 2 +- src/Money.php | 2 +- src/Parser.php | 2 +- src/TaxedMoney.php | 2 +- tests/src/MoneyTest.php | 2 +- tests/src/ParserTest.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pronamic-money.php b/pronamic-money.php index 9372de3..5e5b9fd 100644 --- a/pronamic-money.php +++ b/pronamic-money.php @@ -18,7 +18,7 @@ * GitHub URI: https://github.com/pronamic/wp-money * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Pay */ diff --git a/resources/currencies.php b/resources/currencies.php index abe4ac3..c3f0d0c 100644 --- a/resources/currencies.php +++ b/resources/currencies.php @@ -3,7 +3,7 @@ * Currencies * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/src/Currencies.php b/src/Currencies.php index 87709e3..1044ecf 100644 --- a/src/Currencies.php +++ b/src/Currencies.php @@ -3,7 +3,7 @@ * Currencies * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/src/Currency.php b/src/Currency.php index efca6bd..d4b7cba 100644 --- a/src/Currency.php +++ b/src/Currency.php @@ -3,7 +3,7 @@ * Currency * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/src/Money.php b/src/Money.php index 98a1c97..f21fce5 100644 --- a/src/Money.php +++ b/src/Money.php @@ -3,7 +3,7 @@ * Money * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/src/Parser.php b/src/Parser.php index a0eb035..15b0e96 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -3,7 +3,7 @@ * Parser * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/src/TaxedMoney.php b/src/TaxedMoney.php index 8ce8d06..a93b864 100644 --- a/src/TaxedMoney.php +++ b/src/TaxedMoney.php @@ -3,7 +3,7 @@ * Taxed Money * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/tests/src/MoneyTest.php b/tests/src/MoneyTest.php index 4a60732..3a9d920 100644 --- a/tests/src/MoneyTest.php +++ b/tests/src/MoneyTest.php @@ -3,7 +3,7 @@ * Money * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ diff --git a/tests/src/ParserTest.php b/tests/src/ParserTest.php index 51eb26f..d51522b 100644 --- a/tests/src/ParserTest.php +++ b/tests/src/ParserTest.php @@ -3,7 +3,7 @@ * Parser * * @author Pronamic - * @copyright 2005-2018 Pronamic + * @copyright 2005-2019 Pronamic * @license GPL-3.0-or-later * @package Pronamic\WordPress\Money */ From a900471ac4349a4ce34fc954416f9d03ee5b0a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 03:15:13 +0100 Subject: [PATCH 05/24] Update libraries, coding standards, tests and Travis config. --- .travis.yml | 96 +++++++---- composer.json | 20 ++- composer.lock | 398 +++++++++++++++++--------------------------- phpcs.xml.dist | 7 +- phpunit.xml.dist | 2 +- tests/bootstrap.php | 9 + tests/wp-config.php | 2 - 7 files changed, 244 insertions(+), 290 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17cfe1d..174213c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,38 +4,44 @@ sudo: false language: php -php: -- 5.4 -- 5.5 -- 5.6 -- 7.0 -- 7.1 -- 7.2 -- nightly -- hhvm - env: global: - - WP_TESTS_DB_NAME=wordpress_test - - WP_TESTS_DB_USER=root - - WP_TESTS_DB_PASS= - - WP_TESTS_DB_HOST=localhost + - COMPOSER_NO_INTERACTION=1 + - WP_VERSION=* -matrix: +jobs: include: + - php: 7.2 + env: WP_VERSION=5.0 COVERAGE=1 PHPCS=1 + - php: 7.2 + env: WP_VERSION=4.9 + - php: 7.2 + env: WP_VERSION=4.8 + - php: 7.2 + env: WP_VERSION=4.7 + - php: 7.2 + env: WP_MULTISITE=1 + - php: 7.2 + env: PHPSTAN=1 + - php: 7.2 + env: PHPMD=1 + - php: 7.2 + env: PSALM=1 + - php: 7.1 + - php: 7.0 + - php: 5.6 + - php: 5.5 + - php: 5.4 - php: 5.3 dist: precise env: TRAVIS_DIST_PRECISE=1 - - php: 5.6 - env: WP_MULTISITE=1 - - php: 5.6 - env: WP_VERSION=4.8 - - php: 5.6 - env: WP_VERSION=4.7 COVERAGE=1 GRUNT=1 - fast_finish: true + - php: nightly + - php: hhvm allow_failures: - php: hhvm - php: nightly + - env: PHPMD=1 + - env: PSALM=1 cache: directories: @@ -46,6 +52,25 @@ cache: before_install: # Install latest version of Node.js (https://github.com/creationix/nvm). - if [ "${TRAVIS_DIST_PRECISE}" == "1" ]; then nvm install node; fi + # Create database for PHPUnit tests. + - mysql -e 'CREATE DATABASE wp_phpunit_tests;' + # Remove Xdebug for a huge performance increase: + - | + if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then + phpenv config-rm xdebug.ini + else + echo "xdebug.ini does not exist" + fi + # Raise PHP memory limit to 2048MB + - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + # Validate composer.json file. + - composer validate --strict + # Add Composer global vendor/bin to path. + - export PATH="$HOME/.composer/vendor/bin:$PATH" + # PHPStan + - if [ "$PHPSTAN" == "1" ]; then composer global require phpstan/phpstan; fi + # Psalm + - if [ "$PSALM" == "1" ]; then composer global require vimeo/psalm; fi install: # Install Grunt command line interface (https://github.com/gruntjs/grunt-cli). @@ -56,16 +81,25 @@ install: - composer self-update # Install Composer packages. - composer install - -before_script: - - wget https://raw.githubusercontent.com/wp-cli/sample-plugin/master/bin/install-wp-tests.sh - - bash install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION + # Test on specific WordPress version. + - composer require --dev --update-with-dependencies roots/wordpress:${WP_VERSION} wp-phpunit/wp-phpunit:${WP_VERSION} + # List available packages. + - composer show script: - - if [[ -z "$GRUNT" ]]; then grunt phpunit; fi - - if [[ -z "$GRUNT" ]]; then grunt phplint; fi - - if [[ "$GRUNT" == "1" ]]; then grunt; fi + # PHPLint + - composer run-script phplint + # PHPUnit + - composer run-script phpunit + # PHP_CodeSniffer + - if [ "$PHPCS" == "1" ]; then composer run-script phpcs; fi + # PHP Mess Detector + - if [ "$PHPMD" == "1" ]; then composer run-script phpmd; fi + # PHPStan + - if [ "$PHPSTAN" == "1" ]; then phpstan analyze; fi + # Psalm + - if [ "$PSALM" == "1" ]; then psalm; fi after_success: - - if [ $COVERAGE == "1" ]; then php vendor/bin/coveralls -v; fi - - if [ $COVERAGE == "1" ]; then bash <(curl -s https://codecov.io/bash); fi + - if [ "$COVERAGE" == "1" ]; then composer run-script coveralls; fi + - if [ "$COVERAGE" == "1" ]; then bash <(curl -s https://codecov.io/bash); fi diff --git a/composer.json b/composer.json index 6f6f68d..c3c2496 100644 --- a/composer.json +++ b/composer.json @@ -21,22 +21,28 @@ "php": ">=5.3" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5", "koodimonni-language/de_DE": "*", "koodimonni-language/fr_FR": "*", "koodimonni-language/nl_NL": "*", "php-coveralls/php-coveralls": "^1.1", + "phpcompatibility/php-compatibility": "^9.1", + "phpcompatibility/phpcompatibility-wp": "^2.0", "phpmd/phpmd": "^2.4", "phpunit/phpunit": "^4.8", - "wp-coding-standards/wpcs": "^1.2", - "wimg/php-compatibility": "^9.0", - "johnpbloch/wordpress": "^5.0", - "wp-phpunit/wp-phpunit": "^5.0", - "vlucas/phpdotenv": "^2.0", + "roots/wordpress": "^5.0", "squizlabs/php_codesniffer": "^2.9", - "phpcompatibility/phpcompatibility-wp": "^2.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0" + "vlucas/phpdotenv": "^2.0", + "wp-coding-standards/wpcs": "^1.2", + "wp-phpunit/wp-phpunit": "^5.0" }, "scripts": { + "coveralls": "vendor/bin/coveralls -v", + "phpcbf":"vendor/bin/phpcbf", + "phpcs": "vendor/bin/phpcs -s -v", + "phplint": "ls src/**/*.php tests/**/*.php | xargs -n 1 -P 4 php -l", + "phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php", + "phpunit": "vendor/bin/phpunit", "post-autoload-dump": [ "for file in languages/*.mo ; do ln -f -s ../../../../../../$file vendor/wp-phpunit/wp-phpunit/data/languages/plugins/. ; done", "for file in vendor/koodimonni-language/*/* ; do ln -f -s ../../../../../$file vendor/wp-phpunit/wp-phpunit/data/languages/. ; done", diff --git a/composer.lock b/composer.lock index 59853c7..2581e19 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bfc2274ac248d26c4fd67f4228699139", + "content-hash": "86f7b6f56ddc435d6464f928b996b837", "packages": [], "packages-dev": [ { @@ -223,140 +223,12 @@ "abandoned": "guzzlehttp/guzzle", "time": "2015-03-18T18:23:50+00:00" }, - { - "name": "johnpbloch/wordpress", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/johnpbloch/wordpress.git", - "reference": "391c36c97f55384bbb3e38146752dc9ac6235d4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/391c36c97f55384bbb3e38146752dc9ac6235d4c", - "reference": "391c36c97f55384bbb3e38146752dc9ac6235d4c", - "shasum": "" - }, - "require": { - "johnpbloch/wordpress-core": "5.0.0", - "johnpbloch/wordpress-core-installer": "^1.0", - "php": ">=5.3.2" - }, - "type": "package", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "WordPress Community", - "homepage": "http://wordpress.org/about/" - } - ], - "description": "WordPress is web software you can use to create a beautiful website or blog.", - "homepage": "http://wordpress.org/", - "keywords": [ - "blog", - "cms", - "wordpress" - ], - "time": "2018-12-09T20:56:03+00:00" - }, - { - "name": "johnpbloch/wordpress-core", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "a11a6399a3681ffbbf7e27ac4e372d836529fdb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/a11a6399a3681ffbbf7e27ac4e372d836529fdb7", - "reference": "a11a6399a3681ffbbf7e27ac4e372d836529fdb7", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "provide": { - "wordpress/core-implementation": "5.0.0" - }, - "type": "wordpress-core", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "WordPress Community", - "homepage": "http://wordpress.org/about/" - } - ], - "description": "WordPress is web software you can use to create a beautiful website or blog.", - "homepage": "http://wordpress.org/", - "keywords": [ - "blog", - "cms", - "wordpress" - ], - "time": "2018-12-09T20:55:56+00:00" - }, - { - "name": "johnpbloch/wordpress-core-installer", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/johnpbloch/wordpress-core-installer.git", - "reference": "fd12f5cfe27223b92b0f4bbc097059eb23cc56c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core-installer/zipball/fd12f5cfe27223b92b0f4bbc097059eb23cc56c4", - "reference": "fd12f5cfe27223b92b0f4bbc097059eb23cc56c4", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "conflict": { - "composer/installers": "<1.0.6" - }, - "require-dev": { - "composer/composer": "^1.0", - "phpunit/phpunit": ">=4.8.35" - }, - "type": "composer-plugin", - "extra": { - "class": "johnpbloch\\Composer\\WordPressCorePlugin" - }, - "autoload": { - "psr-0": { - "johnpbloch\\Composer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "John P. Bloch", - "email": "me@johnpbloch.com" - } - ], - "description": "A custom installer to handle deploying WordPress with composer", - "keywords": [ - "wordpress" - ], - "time": "2018-11-09T20:10:38+00:00" - }, { "name": "koodimonni-language/de_de", - "version": "5.0", + "version": "5.0.3", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0/de_DE.zip", + "url": "https://downloads.wordpress.org/translation/core/5.0.3/de_DE.zip", "reference": null, "shasum": null }, @@ -386,10 +258,10 @@ }, { "name": "koodimonni-language/fr_fr", - "version": "5.0", + "version": "5.0.3", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/core/5.0.3/fr_FR.zip", "reference": null, "shasum": null }, @@ -419,10 +291,10 @@ }, { "name": "koodimonni-language/nl_nl", - "version": "5.0", + "version": "5.0.3", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0/nl_NL.zip", + "url": "https://downloads.wordpress.org/translation/core/5.0.3/nl_NL.zip", "reference": null, "shasum": null }, @@ -452,10 +324,10 @@ }, { "name": "koodimonni-plugin-language/akismet-de_de", - "version": "4.1", + "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1/de_DE.zip", + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/de_DE.zip", "reference": null, "shasum": null }, @@ -473,10 +345,10 @@ }, { "name": "koodimonni-plugin-language/akismet-fr_fr", - "version": "4.1", + "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/fr_FR.zip", "reference": null, "shasum": null }, @@ -494,10 +366,10 @@ }, { "name": "koodimonni-plugin-language/akismet-nl_nl", - "version": "4.1", + "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1/nl_NL.zip", + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/nl_NL.zip", "reference": null, "shasum": null }, @@ -578,10 +450,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-de_de", - "version": "3.5.2", + "version": "3.5.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.2/de_DE.zip", + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/de_DE.zip", "reference": null, "shasum": null }, @@ -599,10 +471,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-fr_fr", - "version": "3.5.2", + "version": "3.5.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.2/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/fr_FR.zip", "reference": null, "shasum": null }, @@ -620,10 +492,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-nl_nl", - "version": "3.5.2", + "version": "3.5.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.2/nl_NL.zip", + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/nl_NL.zip", "reference": null, "shasum": null }, @@ -704,10 +576,10 @@ }, { "name": "koodimonni-theme-language/twentyeleven-de_de", - "version": "2.9", + "version": "3.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/2.9/de_DE.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/de_DE.zip", "reference": null, "shasum": null }, @@ -725,10 +597,10 @@ }, { "name": "koodimonni-theme-language/twentyeleven-fr_fr", - "version": "2.9", + "version": "3.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/2.9/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/fr_FR.zip", "reference": null, "shasum": null }, @@ -746,10 +618,10 @@ }, { "name": "koodimonni-theme-language/twentyeleven-nl_nl", - "version": "2.9", + "version": "3.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/2.9/nl_NL.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/nl_NL.zip", "reference": null, "shasum": null }, @@ -767,10 +639,10 @@ }, { "name": "koodimonni-theme-language/twentyfifteen-de_de", - "version": "2.0", + "version": "2.3", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.0/de_DE.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.3/de_DE.zip", "reference": null, "shasum": null }, @@ -788,10 +660,10 @@ }, { "name": "koodimonni-theme-language/twentyfifteen-fr_fr", - "version": "2.0", + "version": "2.3", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.0/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.3/fr_FR.zip", "reference": null, "shasum": null }, @@ -851,10 +723,10 @@ }, { "name": "koodimonni-theme-language/twentyfourteen-fr_fr", - "version": "2.2", + "version": "2.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.2/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.5/fr_FR.zip", "reference": null, "shasum": null }, @@ -914,10 +786,10 @@ }, { "name": "koodimonni-theme-language/twentysixteen-fr_fr", - "version": "1.5", + "version": "1.8", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.5/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.8/fr_FR.zip", "reference": null, "shasum": null }, @@ -977,10 +849,10 @@ }, { "name": "koodimonni-theme-language/twentyten-fr_fr", - "version": "2.5", + "version": "2.7", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.5/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.7/fr_FR.zip", "reference": null, "shasum": null }, @@ -1040,10 +912,10 @@ }, { "name": "koodimonni-theme-language/twentythirteen-fr_fr", - "version": "2.4", + "version": "2.7", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.4/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.7/fr_FR.zip", "reference": null, "shasum": null }, @@ -1103,10 +975,10 @@ }, { "name": "koodimonni-theme-language/twentytwelve-fr_fr", - "version": "2.5", + "version": "2.8", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/fr_FR.zip", + "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.8/fr_FR.zip", "reference": null, "shasum": null }, @@ -1288,16 +1160,16 @@ }, { "name": "phpcompatibility/php-compatibility", - "version": "9.0.0", + "version": "9.1.1", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25" + "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/e9f4047e5edf53c88f36f1dafc0d49454ce13e25", - "reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/2b63c5d284ab8857f7b1d5c240ddb507a6b2293c", + "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c", "shasum": "" }, "require": { @@ -1342,20 +1214,20 @@ "phpcs", "standards" ], - "time": "2018-10-07T17:38:02+00:00" + "time": "2018-12-30T23:16:27+00:00" }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "67d89dcef47f351144d24b247aa968f2269162f7" + "reference": "9160de79fcd683b5c99e9c4133728d91529753ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/67d89dcef47f351144d24b247aa968f2269162f7", - "reference": "67d89dcef47f351144d24b247aa968f2269162f7", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/9160de79fcd683b5c99e9c4133728d91529753ea", + "reference": "9160de79fcd683b5c99e9c4133728d91529753ea", "shasum": "" }, "require": { @@ -1392,7 +1264,7 @@ "polyfill", "standards" ], - "time": "2018-10-07T17:59:30+00:00" + "time": "2018-12-16T19:10:44+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", @@ -2044,6 +1916,100 @@ ], "time": "2018-11-20T15:27:04+00:00" }, + { + "name": "roots/wordpress", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress.git", + "reference": "5.0.3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress/zipball/5.0.3", + "reference": "5.0.3", + "shasum": null + }, + "require": { + "php": ">=5.3.2", + "roots/wordpress-core-installer": ">=1.0.0" + }, + "type": "wordpress-core", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "WordPress Community", + "homepage": "http://wordpress.org/about/" + } + ], + "description": "WordPress is web software you can use to create a beautiful website or blog.", + "homepage": "http://wordpress.org/", + "keywords": [ + "blog", + "cms", + "wordpress" + ], + "time": "2019-01-09T18:28:14+00:00" + }, + { + "name": "roots/wordpress-core-installer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/roots/wordpress-core-installer.git", + "reference": "83744b1ba5bbdb5bb225f47e24da61a6cf6c5b80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roots/wordpress-core-installer/zipball/83744b1ba5bbdb5bb225f47e24da61a6cf6c5b80", + "reference": "83744b1ba5bbdb5bb225f47e24da61a6cf6c5b80", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "conflict": { + "composer/installers": "<1.0.6" + }, + "replace": { + "johnpbloch/wordpress-core-installer": "*" + }, + "require-dev": { + "composer/composer": "^1.0", + "phpunit/phpunit": ">=4.8.35" + }, + "type": "composer-plugin", + "extra": { + "class": "Roots\\Composer\\WordPressCorePlugin" + }, + "autoload": { + "psr-4": { + "Roots\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "John P. Bloch", + "email": "me@johnpbloch.com" + }, + { + "name": "Roots", + "email": "team@roots.io" + } + ], + "description": "A custom installer to handle deploying WordPress with composer", + "keywords": [ + "wordpress" + ], + "time": "2018-12-10T00:22:15+00:00" + }, { "name": "sebastian/comparator", "version": "1.2.4", @@ -2919,76 +2885,18 @@ ], "time": "2015-05-30T16:15:01+00:00" }, - { - "name": "wimg/php-compatibility", - "version": "9.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/e9f4047e5edf53c88f36f1dafc0d49454ce13e25", - "reference": "e9f4047e5edf53c88f36f1dafc0d49454ce13e25", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" - }, - "conflict": { - "squizlabs/php_codesniffer": "2.6.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" - }, - "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", - "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." - }, - "type": "phpcodesniffer-standard", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0-or-later" - ], - "authors": [ - { - "name": "Contributors", - "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" - }, - { - "name": "Wim Godden", - "homepage": "https://github.com/wimg", - "role": "lead" - }, - { - "name": "Juliette Reinders Folmer", - "homepage": "https://github.com/jrfnl", - "role": "lead" - } - ], - "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", - "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", - "keywords": [ - "compatibility", - "phpcs", - "standards" - ], - "time": "2018-10-07T17:38:02+00:00" - }, { "name": "wp-coding-standards/wpcs", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", - "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b" + "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/7aa217ab38156c5cb4eae0f04ae376027c407a9b", - "reference": "7aa217ab38156c5cb4eae0f04ae376027c407a9b", + "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c", + "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c", "shasum": "" }, "require": { @@ -3018,20 +2926,20 @@ "standards", "wordpress" ], - "time": "2018-11-12T10:13:12+00:00" + "time": "2018-12-18T09:43:51+00:00" }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.0.0", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "7a485dc6679beaf61bdeac88ba471b519739e061" + "reference": "a5fed721528ffe75d5730537e48333eed6e5eee4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/7a485dc6679beaf61bdeac88ba471b519739e061", - "reference": "7a485dc6679beaf61bdeac88ba471b519739e061", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/a5fed721528ffe75d5730537e48333eed6e5eee4", + "reference": "a5fed721528ffe75d5730537e48333eed6e5eee4", "shasum": "" }, "type": "library", @@ -3061,7 +2969,7 @@ "test", "wordpress" ], - "time": "2018-12-07T10:16:54+00:00" + "time": "2019-01-10T10:32:31+00:00" } ], "aliases": [], diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 4315093..08b23ed 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,11 +1,9 @@ - - - + . @@ -18,8 +16,9 @@ tests/wp-config.php vendor/* wordpress/* + ^/wp-content/* - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b510b50..5e5e490 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ > - ./tests/src + ./tests/src diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 073a41a..fb21c8e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,12 @@ + * @copyright 2005-2019 Pronamic + * @license GPL-3.0-or-later + * @package Pronamic\WordPress\Money + */ require_once __DIR__ . '/../vendor/autoload.php'; @@ -18,4 +26,5 @@ function _manually_load_plugin() { tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); +// Bootstrap. require getenv( 'WP_PHPUNIT__DIR' ) . '/includes/bootstrap.php'; diff --git a/tests/wp-config.php b/tests/wp-config.php index e2656e9..2152a6b 100644 --- a/tests/wp-config.php +++ b/tests/wp-config.php @@ -52,8 +52,6 @@ define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' ); -$table_prefix = 'tests_'; // Only numbers, letters, and underscores please! - define( 'WP_TESTS_DOMAIN', 'example.org' ); define( 'WP_TESTS_EMAIL', 'admin@example.org' ); define( 'WP_TESTS_TITLE', 'Test Blog' ); From 1cc2f74f2c9bf0af137c32bbcf4c4e13807c65b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 05:59:07 +0100 Subject: [PATCH 06/24] Fix "Deprecation warning: require-dev.koodimonni-language/de_DE is invalid, it should not contain uppercase characters.". --- composer.json | 6 +++--- composer.lock | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c3c2496..ab8c89d 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.5", - "koodimonni-language/de_DE": "*", - "koodimonni-language/fr_FR": "*", - "koodimonni-language/nl_NL": "*", + "koodimonni-language/de_de": "*", + "koodimonni-language/fr_fr": "*", + "koodimonni-language/nl_nl": "*", "php-coveralls/php-coveralls": "^1.1", "phpcompatibility/php-compatibility": "^9.1", "phpcompatibility/phpcompatibility-wp": "^2.0", diff --git a/composer.lock b/composer.lock index 2581e19..375db40 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "86f7b6f56ddc435d6464f928b996b837", + "content-hash": "404fcfe28be1e7061904e754d4a59f43", "packages": [], "packages-dev": [ { From 5ca9f8a1aa9bb8b381f2fb6de7320deb97587bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 06:02:13 +0100 Subject: [PATCH 07/24] Fix composer strict validation error "description : The property description is required". --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index ab8c89d..11c1124 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "pronamic/wp-money", + "description": "WordPress Money library.", "license": "GPL-3.0-or-later" , "autoload": { "psr-4": { From a5b534cd5c978b4e3b33024ec1e3f7bfa2fc2e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 06:05:38 +0100 Subject: [PATCH 08/24] Trying to fix PHPStan build. --- phpstan.neon.dist | 6 ++++++ tests/bootstrap.php | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..6c3ef54 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,6 @@ +parameters: + customRulesetUsed: false + level: max + bootstrap: tests/bootstrap.php + paths: + - src diff --git a/tests/bootstrap.php b/tests/bootstrap.php index fb21c8e..08ec67a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -8,6 +8,8 @@ * @package Pronamic\WordPress\Money */ +putenv( 'WP_PHPUNIT__TESTS_CONFIG=tests/wp-config.php' ); + require_once __DIR__ . '/../vendor/autoload.php'; if ( is_readable( '.env' ) ) { From 9b99d92806a013d45ea5c339f37284e69adee5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 06:31:37 +0100 Subject: [PATCH 09/24] Add Psalm config. --- psalm.xml.dist | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 psalm.xml.dist diff --git a/psalm.xml.dist b/psalm.xml.dist new file mode 100644 index 0000000..b2b5e1f --- /dev/null +++ b/psalm.xml.dist @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c77971649aaa067d2cebe6f69a6506b1eb3a92d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 06:39:19 +0100 Subject: [PATCH 10/24] Allow PHPStan to fail for now. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 174213c..af72428 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ jobs: - php: hhvm - php: nightly - env: PHPMD=1 + - env: PHPSTAN=1 - env: PSALM=1 cache: From 1116c2aabf04037310c7152c6f420558cf2843a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sat, 9 Feb 2019 10:09:29 +0100 Subject: [PATCH 11/24] Use Xdebug for code coverage. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index af72428..214f2c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,10 +57,8 @@ before_install: - mysql -e 'CREATE DATABASE wp_phpunit_tests;' # Remove Xdebug for a huge performance increase: - | - if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then + if [[ "$COVERAGE" != "1" && -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]]; then phpenv config-rm xdebug.ini - else - echo "xdebug.ini does not exist" fi # Raise PHP memory limit to 2048MB - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini From 99a6d7922ad27d6c24ada9b58f85ace83f3d6110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sun, 10 Feb 2019 21:45:48 +0100 Subject: [PATCH 12/24] Use latest WordPress patch version on Travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 214f2c5..4353900 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,7 +81,7 @@ install: # Install Composer packages. - composer install # Test on specific WordPress version. - - composer require --dev --update-with-dependencies roots/wordpress:${WP_VERSION} wp-phpunit/wp-phpunit:${WP_VERSION} + - composer require --dev --update-with-dependencies roots/wordpress:^${WP_VERSION} wp-phpunit/wp-phpunit:^${WP_VERSION} # List available packages. - composer show From 989cf419bc6332b500faba06611cd85bccacd232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Sun, 10 Feb 2019 22:17:38 +0100 Subject: [PATCH 13/24] Use `find` in phplint composer script, as Bash globstar might be disabled. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 11c1124..8a9b82c 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "coveralls": "vendor/bin/coveralls -v", "phpcbf":"vendor/bin/phpcbf", "phpcs": "vendor/bin/phpcs -s -v", - "phplint": "ls src/**/*.php tests/**/*.php | xargs -n 1 -P 4 php -l", + "phplint": "find src tests -name '*.php' | xargs -n 1 -P 4 php -l", "phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php", "phpunit": "vendor/bin/phpunit", "post-autoload-dump": [ From ce4954849345743d2699ab5573957fe3adc54493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 11 Feb 2019 10:07:44 +0100 Subject: [PATCH 14/24] Fix Travis using latests WordPress versions with WP_VERSION. --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4353900..6fe7929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,13 @@ env: jobs: include: - php: 7.2 - env: WP_VERSION=5.0 COVERAGE=1 PHPCS=1 + env: WP_VERSION=^5.0 COVERAGE=1 PHPCS=1 - php: 7.2 - env: WP_VERSION=4.9 + env: WP_VERSION=^4.9 - php: 7.2 - env: WP_VERSION=4.8 + env: WP_VERSION=^4.8 - php: 7.2 - env: WP_VERSION=4.7 + env: WP_VERSION=^4.7 - php: 7.2 env: WP_MULTISITE=1 - php: 7.2 @@ -81,7 +81,7 @@ install: # Install Composer packages. - composer install # Test on specific WordPress version. - - composer require --dev --update-with-dependencies roots/wordpress:^${WP_VERSION} wp-phpunit/wp-phpunit:^${WP_VERSION} + - composer require --dev --update-with-dependencies roots/wordpress:${WP_VERSION} wp-phpunit/wp-phpunit:${WP_VERSION} # List available packages. - composer show From 17b7dc41fd444fe1ff09647e0a39f575cc38f324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 11 Feb 2019 12:01:34 +0100 Subject: [PATCH 15/24] Update phpcs config relative exclude pattern for `wp-content`. --- phpcs.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 08b23ed..c7771af 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -16,7 +16,7 @@ tests/wp-config.php vendor/* wordpress/* - ^/wp-content/* + ^wp-content/* From 8240d12180a595267ea3c0b5a4a1b90f6d618669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 12 Feb 2019 16:59:02 +0100 Subject: [PATCH 16/24] Add Scrutinizer config override to run composer scripts on install. --- .scrutinizer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 18894ae..54b5058 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -8,6 +8,9 @@ build: project_setup: before: - mysql -e "CREATE DATABASE wp_phpunit_tests" + dependencies: + override: + - composer install --ignore-platform-reqs --no-interaction nodes: coverage: tests: From c1373b034494a6f642ef72f7768aef58f7e58ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 14 Feb 2019 12:19:02 +0100 Subject: [PATCH 17/24] Add `get_minor_units` method based on decimals of currency. --- resources/currencies.php | 52 ++++++++++++++++++++++++++++++---------- src/Money.php | 24 +++++++++++++++++++ tests/src/MoneyTest.php | 28 ++++++++++++++++++++++ 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/resources/currencies.php b/resources/currencies.php index c3f0d0c..3c09f05 100644 --- a/resources/currencies.php +++ b/resources/currencies.php @@ -20,6 +20,20 @@ * @version 1.2.0 */ return array( + array( + 'alphabetic_code' => 'AUD', + 'numeric_code' => '036', + 'name' => __( 'Australian Dollar', 'pronamic-money' ), + 'symbol' => '$', + 'number_decimals' => 2, + ), + array( + 'alphabetic_code' => 'BHD', + 'numeric_code' => '048', + 'name' => __( 'Bahraini Dinar', 'pronamic-money' ), + 'symbol' => '.د.ب', + 'number_decimals' => 3, + ), array( 'alphabetic_code' => 'EUR', 'numeric_code' => '978', @@ -27,13 +41,6 @@ 'symbol' => '€', 'number_decimals' => 2, ), - array( - 'alphabetic_code' => 'NLG', - 'numeric_code' => null, - 'name' => __( 'Gulden', 'pronamic-money' ), - 'symbol' => 'G', - 'number_decimals' => 4, - ), array( 'alphabetic_code' => 'GBP', 'numeric_code' => '826', @@ -41,6 +48,20 @@ 'symbol' => '£', 'number_decimals' => 2, ), + array( + 'alphabetic_code' => 'JPY', + 'numeric_code' => '392', + 'name' => __( 'Japanese Yen', 'pronamic-money' ), + 'symbol' => '¥', + 'number_decimals' => 0, + ), + array( + 'alphabetic_code' => 'NLG', + 'numeric_code' => null, + 'name' => __( 'Gulden', 'pronamic-money' ), + 'symbol' => 'G', + 'number_decimals' => 4, + ), array( 'alphabetic_code' => 'USD', 'numeric_code' => '840', @@ -49,10 +70,17 @@ 'number_decimals' => 2, ), array( - 'alphabetic_code' => 'AUD', - 'numeric_code' => '036', - 'name' => __( 'Australian Dollar', 'pronamic-money' ), - 'symbol' => '$', - 'number_decimals' => 2, + 'alphabetic_code' => 'XAF', + 'numeric_code' => '950', + 'name' => __( 'CFA Franc BEAC', 'pronamic-money' ), + 'symbol' => 'CFA', + 'number_decimals' => 0, + ), + array( + 'alphabetic_code' => 'XOF', + 'numeric_code' => '952', + 'name' => __( 'CFA Franc BCEAO', 'pronamic-money' ), + 'symbol' => 'CFA', + 'number_decimals' => 0, ), ); diff --git a/src/Money.php b/src/Money.php index f21fce5..c417c26 100644 --- a/src/Money.php +++ b/src/Money.php @@ -111,6 +111,30 @@ public function get_cents() { return $this->value * 100; } + /** + * Get amount in minor units. + * + * Examples for value 10: + * JPY 0 decimals: 10 + * EUR 2 decimals: 1000 + * BHD 3 decimals: 10000 + * NLG 4 decimals: 100000 + * + * @return int + */ + public function get_minor_units() { + // Use 2 decimals by default (most common). + $decimals = 2; + + // Get number of decimals from currency if available. + if ( $this->get_currency() ) { + $decimals = $this->currency->get_number_decimals(); + } + + // Return amount in minor units. + return (int) $this->value * pow( 10, $decimals ); + } + /** * Set value. * diff --git a/tests/src/MoneyTest.php b/tests/src/MoneyTest.php index 3a9d920..d4e3b3e 100644 --- a/tests/src/MoneyTest.php +++ b/tests/src/MoneyTest.php @@ -165,4 +165,32 @@ public function test_cents() { $this->assertEquals( 0.01, $money->get_cents() ); } + + /** + * Test minor units. + * + * @dataProvider minor_units_provider + * + * @param string $currency Currency. + * @param int $expected Expected value. + */ + public function test_minor_units( $currency, $expected ) { + $money = new Money( 10, $currency ); + + $this->assertEquals( $expected, $money->get_minor_units() ); + } + + /** + * Minor units provider. + * + * @return array + */ + public function minor_units_provider() { + return array( + array( 'JPY', 10 ), + array( 'EUR', 1000 ), + array( 'BHD', 10000 ), + array( 'NLG', 100000 ), + ); + } } From f10f86ba02cd05933143e093a5e45c7898b5dc14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 28 Feb 2019 14:55:26 +0100 Subject: [PATCH 18/24] Fix incorrect conversion to integer for minor units. --- src/Money.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Money.php b/src/Money.php index c417c26..1d6d493 100644 --- a/src/Money.php +++ b/src/Money.php @@ -132,7 +132,9 @@ public function get_minor_units() { } // Return amount in minor units. - return (int) $this->value * pow( 10, $decimals ); + $minor_units = $this->value * pow( 10, $decimals ); + + return (int) $minor_units; } /** From 9a0e035093b48839d3583dc9c85003b070a2d5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 28 Feb 2019 16:50:09 +0100 Subject: [PATCH 19/24] composer update --- composer.lock | 194 ++++++++++++++++---------------------------------- 1 file changed, 60 insertions(+), 134 deletions(-) diff --git a/composer.lock b/composer.lock index 375db40..ba56257 100644 --- a/composer.lock +++ b/composer.lock @@ -225,12 +225,10 @@ }, { "name": "koodimonni-language/de_de", - "version": "5.0.3", + "version": "5.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0.3/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/core/5.1/de_DE.zip" }, "require": { "koodimonni-plugin-language/akismet-de_de": "*", @@ -258,12 +256,10 @@ }, { "name": "koodimonni-language/fr_fr", - "version": "5.0.3", + "version": "5.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0.3/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/core/5.1/fr_FR.zip" }, "require": { "koodimonni-plugin-language/akismet-fr_fr": "*", @@ -291,12 +287,10 @@ }, { "name": "koodimonni-language/nl_nl", - "version": "5.0.3", + "version": "5.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.0.3/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/core/5.1/nl_NL.zip" }, "require": { "koodimonni-plugin-language/akismet-nl_nl": "*", @@ -327,9 +321,7 @@ "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -348,9 +340,7 @@ "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -369,9 +359,7 @@ "version": "4.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/akismet/4.1.1/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -390,9 +378,7 @@ "version": "2.5.14", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -411,9 +397,7 @@ "version": "2.5.14", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -432,9 +416,7 @@ "version": "2.5.14", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/bbpress/2.5.14/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -450,12 +432,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-de_de", - "version": "3.5.4", + "version": "3.5.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -471,12 +451,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-fr_fr", - "version": "3.5.4", + "version": "3.5.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -492,12 +470,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-nl_nl", - "version": "3.5.4", + "version": "3.5.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.4/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -516,9 +492,7 @@ "version": "0.6.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -537,9 +511,7 @@ "version": "0.6.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -558,9 +530,7 @@ "version": "0.6.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/plugin/wordpress-importer/0.6.4/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -579,9 +549,7 @@ "version": "3.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -597,12 +565,10 @@ }, { "name": "koodimonni-theme-language/twentyeleven-fr_fr", - "version": "3.1", + "version": "3.2", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.2/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -621,9 +587,7 @@ "version": "3.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -639,12 +603,10 @@ }, { "name": "koodimonni-theme-language/twentyfifteen-de_de", - "version": "2.3", + "version": "2.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.3/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.4/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -660,12 +622,10 @@ }, { "name": "koodimonni-theme-language/twentyfifteen-fr_fr", - "version": "2.3", + "version": "2.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.3/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.4/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -684,9 +644,7 @@ "version": "2.0", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.0/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfifteen/2.0/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -705,9 +663,7 @@ "version": "2.2", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.2/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.2/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -723,12 +679,10 @@ }, { "name": "koodimonni-theme-language/twentyfourteen-fr_fr", - "version": "2.5", + "version": "2.6", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.5/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.6/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -747,9 +701,7 @@ "version": "2.2", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.2/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyfourteen/2.2/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -768,9 +720,7 @@ "version": "1.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.5/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.5/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -786,12 +736,10 @@ }, { "name": "koodimonni-theme-language/twentysixteen-fr_fr", - "version": "1.8", + "version": "1.9", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.8/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.9/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -807,12 +755,10 @@ }, { "name": "koodimonni-theme-language/twentysixteen-nl_nl", - "version": "1.5", + "version": "1.9", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.5/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentysixteen/1.9/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -831,9 +777,7 @@ "version": "2.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.5/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.5/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -849,12 +793,10 @@ }, { "name": "koodimonni-theme-language/twentyten-fr_fr", - "version": "2.7", + "version": "2.8", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.7/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.8/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -873,9 +815,7 @@ "version": "2.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.5/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentyten/2.5/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -894,9 +834,7 @@ "version": "2.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.4/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.4/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -912,12 +850,10 @@ }, { "name": "koodimonni-theme-language/twentythirteen-fr_fr", - "version": "2.7", + "version": "2.8", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.7/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.8/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -936,9 +872,7 @@ "version": "2.4", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.4/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentythirteen/2.4/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -957,9 +891,7 @@ "version": "2.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/de_DE.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -975,12 +907,10 @@ }, { "name": "koodimonni-theme-language/twentytwelve-fr_fr", - "version": "2.8", + "version": "2.9", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.8/fr_FR.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.9/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -999,9 +929,7 @@ "version": "2.5", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/nl_NL.zip", - "reference": null, - "shasum": null + "url": "https://downloads.wordpress.org/translation/theme/twentytwelve/2.5/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -1918,17 +1846,15 @@ }, { "name": "roots/wordpress", - "version": "5.0.3", + "version": "5.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress.git", - "reference": "5.0.3" + "reference": "5.1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress/zipball/5.0.3", - "reference": "5.0.3", - "shasum": null + "url": "https://api.github.com/repos/WordPress/WordPress/zipball/5.1" }, "require": { "php": ">=5.3.2", @@ -1952,7 +1878,7 @@ "cms", "wordpress" ], - "time": "2019-01-09T18:28:14+00:00" + "time": "2019-02-22T00:57:46+00:00" }, { "name": "roots/wordpress-core-installer", @@ -2930,16 +2856,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.0.3", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "a5fed721528ffe75d5730537e48333eed6e5eee4" + "reference": "b3948a3df9507af4d2367c4fa1ba3bac34a35961" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/a5fed721528ffe75d5730537e48333eed6e5eee4", - "reference": "a5fed721528ffe75d5730537e48333eed6e5eee4", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/b3948a3df9507af4d2367c4fa1ba3bac34a35961", + "reference": "b3948a3df9507af4d2367c4fa1ba3bac34a35961", "shasum": "" }, "type": "library", @@ -2969,7 +2895,7 @@ "test", "wordpress" ], - "time": "2019-01-10T10:32:31+00:00" + "time": "2019-02-22T10:51:01+00:00" } ], "aliases": [], From 5f98ba7a348a9ce0a2b26d6b705f8a0e5c19b530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 6 Mar 2019 16:28:33 +0100 Subject: [PATCH 20/24] Use BC Math multiply in minor units calculation. --- src/Money.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Money.php b/src/Money.php index 1d6d493..516e48b 100644 --- a/src/Money.php +++ b/src/Money.php @@ -132,7 +132,11 @@ public function get_minor_units() { } // Return amount in minor units. - $minor_units = $this->value * pow( 10, $decimals ); + if ( function_exists( 'bcmul' ) ) { + $minor_units = bcmul( $this->value, pow( 10, $decimals ), 0 ); + } else { + $minor_units = $this->value * pow( 10, $decimals ); + } return (int) $minor_units; } From 63d4ceeaf5897911420d95091fa9f20e61c2d8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 6 Mar 2019 16:29:17 +0100 Subject: [PATCH 21/24] Cast minor units to string before casting to integer. --- src/Money.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Money.php b/src/Money.php index 516e48b..59aa9e9 100644 --- a/src/Money.php +++ b/src/Money.php @@ -138,7 +138,7 @@ public function get_minor_units() { $minor_units = $this->value * pow( 10, $decimals ); } - return (int) $minor_units; + return (int) (string) $minor_units; } /** From c4a7465f0a786c6ac711afc124e81d78a1a45718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 7 Mar 2019 13:49:54 +0100 Subject: [PATCH 22/24] Update Travis PHP version from 7.2 to 7.3. --- .travis.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fe7929..f7fca23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ env: jobs: include: - - php: 7.2 + - php: 7.3 env: WP_VERSION=^5.0 COVERAGE=1 PHPCS=1 - php: 7.2 env: WP_VERSION=^4.9 @@ -19,14 +19,15 @@ jobs: env: WP_VERSION=^4.8 - php: 7.2 env: WP_VERSION=^4.7 - - php: 7.2 + - php: 7.3 env: WP_MULTISITE=1 - - php: 7.2 + - php: 7.3 env: PHPSTAN=1 - - php: 7.2 + - php: 7.3 env: PHPMD=1 - - php: 7.2 + - php: 7.3 env: PSALM=1 + - php: 7.2 - php: 7.1 - php: 7.0 - php: 5.6 From b31760fd8842e2aed90ededd7569cb4955b2cd22 Mon Sep 17 00:00:00 2001 From: Remco Tolsma Date: Fri, 8 Mar 2019 14:49:12 +0100 Subject: [PATCH 23/24] Improved documentation. --- src/Currency.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Currency.php b/src/Currency.php index d4b7cba..21364c4 100644 --- a/src/Currency.php +++ b/src/Currency.php @@ -21,28 +21,28 @@ class Currency { /** * Alphabetic code. * - * @var string + * @var string|null */ private $alphabetic_code; /** * Numeric code. * - * @var string + * @var string|null */ private $numeric_code; /** * Symbol. * - * @var string + * @var string|null */ private $symbol; /** * Name. * - * @var string + * @var string|null */ private $name; @@ -63,7 +63,7 @@ public function __construct() { /** * Get alphabetic code. * - * @return null|string + * @return string|null */ public function get_alphabetic_code() { return $this->alphabetic_code; @@ -72,7 +72,7 @@ public function get_alphabetic_code() { /** * Set alphabetic code. * - * @param string $alphabetic_code Alphabetic code. + * @param string|null $alphabetic_code Alphabetic code. */ public function set_alphabetic_code( $alphabetic_code ) { $this->alphabetic_code = $alphabetic_code; @@ -81,7 +81,7 @@ public function set_alphabetic_code( $alphabetic_code ) { /** * Get numeric code. * - * @return null|string + * @return string|null */ public function get_numeric_code() { return $this->numeric_code; @@ -90,7 +90,7 @@ public function get_numeric_code() { /** * Set numeric code. * - * @param string $numeric_code Numeric code. + * @param string|null $numeric_code Numeric code. */ public function set_numeric_code( $numeric_code ) { $this->numeric_code = $numeric_code; @@ -99,7 +99,7 @@ public function set_numeric_code( $numeric_code ) { /** * Get symbol. * - * @return null|string + * @return string|null */ public function get_symbol() { return $this->symbol; @@ -108,7 +108,7 @@ public function get_symbol() { /** * Set symbol. * - * @param string $symbol Symbol. + * @param string|null $symbol Symbol. */ public function set_symbol( $symbol ) { $this->symbol = $symbol; @@ -146,7 +146,7 @@ public static function get_instance( $alphabetic_code ) { /** * Get name. * - * @return null|string + * @return string|null */ public function get_name() { return $this->name; @@ -155,7 +155,7 @@ public function get_name() { /** * Set name. * - * @param string $name Currency name. + * @param string|null $name Currency name. */ public function set_name( $name ) { $this->name = $name; From 1b0bedfaeb2e9c808a3971b8c615acd0db9ebbbc Mon Sep 17 00:00:00 2001 From: Remco Tolsma Date: Wed, 27 Mar 2019 16:36:10 +0100 Subject: [PATCH 24/24] Updated to 1.2.1. --- CHANGELOG.md | 4 + composer.json | 4 +- composer.lock | 46 +++--- languages/pronamic-money-nl_NL.mo | Bin 973 -> 967 bytes languages/pronamic-money-nl_NL.po | 10 +- languages/pronamic-money.pot | 16 +- package-lock.json | 265 +++++++++++++----------------- package.json | 6 +- pronamic-money.php | 2 +- src/Currencies.php | 2 +- src/Currency.php | 2 +- src/Money.php | 4 +- src/Parser.php | 2 +- src/TaxedMoney.php | 2 +- tests/src/MoneyTest.php | 6 +- tests/src/ParserTest.php | 2 +- 16 files changed, 178 insertions(+), 195 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59fd4c0..1790aec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] - +## [1.2.1] - 2019-03-27 +- Added `get_minor_units` method based on decimals of currency. +- Updated copyright to 2005-2019 Pronamic. + ## [1.2.0] - 2018-12-10 - Added a `get_cents` method. - Introduced a TaxedMoney class. diff --git a/composer.json b/composer.json index 8a9b82c..09aa68b 100644 --- a/composer.json +++ b/composer.json @@ -31,11 +31,11 @@ "phpcompatibility/phpcompatibility-wp": "^2.0", "phpmd/phpmd": "^2.4", "phpunit/phpunit": "^4.8", - "roots/wordpress": "^5.0", + "roots/wordpress": "^5.1", "squizlabs/php_codesniffer": "^2.9", "vlucas/phpdotenv": "^2.0", "wp-coding-standards/wpcs": "^1.2", - "wp-phpunit/wp-phpunit": "^5.0" + "wp-phpunit/wp-phpunit": "^5.1" }, "scripts": { "coveralls": "vendor/bin/coveralls -v", diff --git a/composer.lock b/composer.lock index ba56257..d67e9ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "404fcfe28be1e7061904e754d4a59f43", + "content-hash": "1c6d5b86a0c239671fbd370bc3b6f2f4", "packages": [], "packages-dev": [ { @@ -225,10 +225,10 @@ }, { "name": "koodimonni-language/de_de", - "version": "5.1", + "version": "5.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.1/de_DE.zip" + "url": "https://downloads.wordpress.org/translation/core/5.1.1/de_DE.zip" }, "require": { "koodimonni-plugin-language/akismet-de_de": "*", @@ -256,10 +256,10 @@ }, { "name": "koodimonni-language/fr_fr", - "version": "5.1", + "version": "5.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.1/fr_FR.zip" + "url": "https://downloads.wordpress.org/translation/core/5.1.1/fr_FR.zip" }, "require": { "koodimonni-plugin-language/akismet-fr_fr": "*", @@ -287,10 +287,10 @@ }, { "name": "koodimonni-language/nl_nl", - "version": "5.1", + "version": "5.1.1", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/core/5.1/nl_NL.zip" + "url": "https://downloads.wordpress.org/translation/core/5.1.1/nl_NL.zip" }, "require": { "koodimonni-plugin-language/akismet-nl_nl": "*", @@ -432,10 +432,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-de_de", - "version": "3.5.5", + "version": "3.5.7", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/de_DE.zip" + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.7/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -451,10 +451,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-fr_fr", - "version": "3.5.5", + "version": "3.5.7", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/fr_FR.zip" + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.7/fr_FR.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -470,10 +470,10 @@ }, { "name": "koodimonni-plugin-language/woocommerce-nl_nl", - "version": "3.5.5", + "version": "3.5.7", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.5/nl_NL.zip" + "url": "https://downloads.wordpress.org/translation/plugin/woocommerce/3.5.7/nl_NL.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -546,10 +546,10 @@ }, { "name": "koodimonni-theme-language/twentyeleven-de_de", - "version": "3.1", + "version": "3.2", "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.1/de_DE.zip" + "url": "https://downloads.wordpress.org/translation/theme/twentyeleven/3.2/de_DE.zip" }, "require": { "koodimonni/composer-dropin-installer": ">=0.2.3" @@ -1795,6 +1795,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2015-10-02T06:51:40+00:00" }, { @@ -1846,15 +1847,16 @@ }, { "name": "roots/wordpress", - "version": "5.1", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress.git", - "reference": "5.1" + "reference": "5.1.1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress/zipball/5.1" + "url": "https://api.github.com/repos/WordPress/WordPress/zipball/5.1.1", + "reference": "5.1.1" }, "require": { "php": ">=5.3.2", @@ -1868,17 +1870,17 @@ "authors": [ { "name": "WordPress Community", - "homepage": "http://wordpress.org/about/" + "homepage": "https://wordpress.org/about/" } ], "description": "WordPress is web software you can use to create a beautiful website or blog.", - "homepage": "http://wordpress.org/", + "homepage": "https://wordpress.org/", "keywords": [ "blog", "cms", "wordpress" ], - "time": "2019-02-22T00:57:46+00:00" + "time": "2019-03-13T14:18:06+00:00" }, { "name": "roots/wordpress-core-installer", @@ -2856,7 +2858,7 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", diff --git a/languages/pronamic-money-nl_NL.mo b/languages/pronamic-money-nl_NL.mo index dd2e55300d6e64208fb186a067816e36f3888d44..07ee6db31927a59c66d6114d63b0b943cf80f2f4 100644 GIT binary patch delta 110 zcmX@hew=+mi0L~<1_pm1=3ro8uw!Om-~-a`Kw1V!hXH8`AYBZk^?`H`kmdr?dp34z sF*21GOy12X%WtV`V61Cou3%_tWo&9?IQcoFEH7Nl3@El)kZBJi0LJSRjsO4v delta 140 zcmX@kewKYgi0Kzb1_pm1=3ro8aA9U(-~-aWKw1V!#{g*wAYBQh^?~#xAk77&4{hw! zVl*iz%Fj#8%}mzK&Cg4%\n" "Language-Team: Pronamic \n" "Language: nl_NL\n" @@ -36,8 +36,8 @@ msgstr "Pronamic" msgid "https://www.pronamic.eu/" msgstr "https://www.pronamic.nl/" -#. translators: 1: currency symbol, 2: amount, 3: currency code, note: use -#. non-breaking space! +#. translators: 1: currency symbol, 2: amount value, 3: currency code, note: +#. use non-breaking space! #: src/Money.php:53 msgctxt "money format" msgid "%1$s%2$s %3$s" diff --git a/languages/pronamic-money.pot b/languages/pronamic-money.pot index 6e9a8d0..3923363 100644 --- a/languages/pronamic-money.pot +++ b/languages/pronamic-money.pot @@ -1,17 +1,17 @@ -# Copyright (C) 2018 Pronamic +# Copyright (C) 2019 Pronamic # This file is distributed under the GPL-3.0-or-later. msgid "" msgstr "" -"Project-Id-Version: Pronamic Money 1.1.0\n" -"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pronamic-money\n" -"POT-Creation-Date: 2018-08-16 09:55:50+00:00\n" +"Project-Id-Version: Pronamic Money 1.2.1\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-money\n" +"POT-Creation-Date: 2019-03-27 15:35:10+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -"X-Generator: grunt-wp-i18n1.0.2\n" +"X-Generator: grunt-wp-i18n 1.0.3\n" #. Plugin Name of the plugin/theme msgid "Pronamic Money" @@ -34,8 +34,8 @@ msgid "https://www.pronamic.eu/" msgstr "" #: src/Money.php:53 -#. translators: 1: currency symbol, 2: amount, 3: currency code, note: use -#. non-breaking space! +#. translators: 1: currency symbol, 2: amount value, 3: currency code, note: +#. use non-breaking space! msgctxt "money format" msgid "%1$s%2$s %3$s" msgstr "" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e8a5b1d..ffb48e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wp-money", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -82,9 +82,9 @@ "dev": true }, "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", + "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==", "dev": true }, "brace-expansion": { @@ -97,12 +97,6 @@ "concat-map": "0.0.1" } }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "cache-swap": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/cache-swap/-/cache-swap-0.3.0.tgz", @@ -143,9 +137,9 @@ } }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -236,9 +230,9 @@ "dev": true }, "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "eventemitter2": { @@ -306,13 +300,14 @@ "dev": true }, "gettext-parser": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.3.1.tgz", - "integrity": "sha512-W4t55eB/c7WrH0gbCHFiHuaEnJ1WiPJVnbFFiNEoh2QkOmuSLxs0PmJDGAmCQuTJCU740Fmb6D+2D/2xECWZGQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-3.1.1.tgz", + "integrity": "sha512-vNhWcqXEtZPs5Ft1ReA34g7ByWotpcOIeJvXVy2jF3/G2U9v6W0wG4Z4hXzcU8R//jArqkgHcVCGgGqa4vxVlQ==", "dev": true, "requires": { "encoding": "^0.1.12", - "safe-buffer": "^5.1.1" + "readable-stream": "^3.2.0", + "safe-buffer": "^5.1.2" } }, "glob": { @@ -336,9 +331,9 @@ "dev": true }, "grunt": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.3.tgz", - "integrity": "sha512-/JzmZNPfKorlCrrmxWqQO4JVodO+DVd5XX4DkocL/1WlLlKVLE9+SdEIempOAxDhWPysLle6afvn/hg7Ck2k9g==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.4.tgz", + "integrity": "sha512-PYsMOrOC+MsdGEkFVwMaMyc6Ob7pKmq+deg1Sjr+vvMWp35sztfwKE7qoN51V+UEtHsyNuMcGdgMLFkBHvMxHQ==", "dev": true, "requires": { "coffeescript": "~1.10.0", @@ -352,7 +347,7 @@ "grunt-legacy-log": "~2.0.0", "grunt-legacy-util": "~1.1.1", "iconv-lite": "~0.4.13", - "js-yaml": "~3.5.2", + "js-yaml": "~3.13.0", "minimatch": "~3.0.2", "mkdirp": "~0.5.1", "nopt": "~3.0.6", @@ -372,13 +367,35 @@ "resolve": "~1.1.0" } }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } } } } @@ -437,14 +454,6 @@ "requires": { "chalk": "~2.4.1", "lodash": "~4.17.10" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "grunt-legacy-util": { @@ -460,14 +469,6 @@ "lodash": "~4.17.10", "underscore.string": "~3.3.4", "which": "~1.3.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - } } }, "grunt-phpcs": { @@ -754,63 +755,13 @@ "dev": true }, "grunt-wp-i18n": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/grunt-wp-i18n/-/grunt-wp-i18n-1.0.2.tgz", - "integrity": "sha512-s7DdR1wRYWvgeQOELL/s8AmWz0scVUq+h0yYVWvLx23kTXOBslvaD35NTvubyM+MO+k29bgND0gDDvS6sHixfg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/grunt-wp-i18n/-/grunt-wp-i18n-1.0.3.tgz", + "integrity": "sha512-CJNbEKeBeOSAPeaJ9B8iCgSwtaG63UR9/uT46a4OsIqnFhOJpeAi138JTlvjfIbnDVoBrzvdrKJe1svveLjUtA==", "dev": true, "requires": { - "grunt": "^1.0.2", - "node-wp-i18n": "^1.0.5" - }, - "dependencies": { - "grunt": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.3.tgz", - "integrity": "sha512-/JzmZNPfKorlCrrmxWqQO4JVodO+DVd5XX4DkocL/1WlLlKVLE9+SdEIempOAxDhWPysLle6afvn/hg7Ck2k9g==", - "dev": true, - "requires": { - "coffeescript": "~1.10.0", - "dateformat": "~1.0.12", - "eventemitter2": "~0.4.13", - "exit": "~0.1.1", - "findup-sync": "~0.3.0", - "glob": "~7.0.0", - "grunt-cli": "~1.2.0", - "grunt-known-options": "~1.1.0", - "grunt-legacy-log": "~2.0.0", - "grunt-legacy-util": "~1.1.1", - "iconv-lite": "~0.4.13", - "js-yaml": "~3.5.2", - "minimatch": "~3.0.2", - "mkdirp": "~0.5.1", - "nopt": "~3.0.6", - "path-is-absolute": "~1.0.0", - "rimraf": "~2.6.2" - }, - "dependencies": { - "grunt-cli": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", - "integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", - "dev": true, - "requires": { - "findup-sync": "~0.3.0", - "grunt-known-options": "~1.1.0", - "nopt": "~3.0.6", - "resolve": "~1.1.0" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - } - } - } + "grunt": "^1.0.3", + "node-wp-i18n": "^1.2.2" } }, "has-color": { @@ -838,12 +789,12 @@ "dev": true }, "iconv-lite": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", - "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "indent-string": { @@ -877,15 +828,6 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -908,13 +850,13 @@ "dev": true }, "js-yaml": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", - "integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz", + "integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==", "dev": true, "requires": { - "argparse": "^1.0.2", - "esprima": "^2.6.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, "load-grunt-tasks": { @@ -961,9 +903,9 @@ } }, "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, "loud-rejection": { @@ -1051,13 +993,13 @@ } }, "node-wp-i18n": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/node-wp-i18n/-/node-wp-i18n-1.1.1.tgz", - "integrity": "sha512-SI3+vhddQDBh2pkOowqPdXs/YN/bRnNvR4gDmcSJaQ4P+z8jSuPRZTFFClaD/fVv0AG0zY/ku07oQuayr844Mg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/node-wp-i18n/-/node-wp-i18n-1.2.3.tgz", + "integrity": "sha512-YMzMcsjXbGYDB9vHyb289CYXAGmXhcNLbeTlOnWgPNkZd9xrovcbRd7cQyKd9BQHOjS7Nw8WCbJ7nvtR7rc0rg==", "dev": true, "requires": { "bluebird": "^3.4.1", - "gettext-parser": "^1.2.0", + "gettext-parser": "^3.1.0", "glob": "^7.0.5", "lodash": "^4.14.2", "minimist": "^1.2.0", @@ -1075,13 +1017,13 @@ } }, "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "requires": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } @@ -1161,6 +1103,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, "path-type": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", @@ -1234,6 +1182,17 @@ "read-pkg": "^1.0.0" } }, + "readable-stream": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.2.0.tgz", + "integrity": "sha512-RV20kLjdmpZuTF1INEb9IA3L68Nmi+Ri7ppZqo78wj//Pn62fCoJyV9zalccNzDD/OuJpMG4f+pfMl8+L6QdGw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "redent": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", @@ -1254,10 +1213,13 @@ } }, "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } }, "resolve-from": { "version": "2.0.0", @@ -1281,9 +1243,9 @@ "dev": true }, "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "safer-buffer": { @@ -1293,9 +1255,9 @@ "dev": true }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "dev": true }, "sigmund": { @@ -1311,9 +1273,9 @@ "dev": true }, "spdx-correct": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", - "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -1337,17 +1299,26 @@ } }, "spdx-license-ids": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz", - "integrity": "sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz", + "integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==", "dev": true }, "sprintf-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", - "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "dev": true }, + "string_decoder": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", + "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, "strip-bom": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", diff --git a/package.json b/package.json index 00db5a3..6a45b60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-money", - "version": "1.2.0", + "version": "1.2.1", "description": "WordPress Money library.", "repository": { "type": "git", @@ -19,12 +19,12 @@ }, "homepage": "https://github.com/pronamic/wp-money#readme", "devDependencies": { - "grunt": "^1.0.3", + "grunt": "^1.0.4", "grunt-checktextdomain": "^1.0.1", "grunt-phpcs": "^0.4.0", "grunt-phplint": "0.1.0", "grunt-phpunit": "^0.3.6", - "grunt-wp-i18n": "^1.0.2", + "grunt-wp-i18n": "^1.0.3", "load-grunt-tasks": "^4.0.0" } } diff --git a/pronamic-money.php b/pronamic-money.php index 5e5b9fd..52ba67a 100644 --- a/pronamic-money.php +++ b/pronamic-money.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.pronamic.eu/plugins/pronamic-money/ * Description: WordPress Money library. * - * Version: 1.2.0 + * Version: 1.2.1 * Requires at least: 4.7 * * Author: Pronamic diff --git a/src/Currencies.php b/src/Currencies.php index 1044ecf..a22c99d 100644 --- a/src/Currencies.php +++ b/src/Currencies.php @@ -16,7 +16,7 @@ * @link https://github.com/moneyphp/money/blob/v3.1.3/resources/currency.php * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.0.0 */ class Currencies { diff --git a/src/Currency.php b/src/Currency.php index 21364c4..9208654 100644 --- a/src/Currency.php +++ b/src/Currency.php @@ -14,7 +14,7 @@ * Currency * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.0.0 */ class Currency { diff --git a/src/Money.php b/src/Money.php index 59aa9e9..bcdaccf 100644 --- a/src/Money.php +++ b/src/Money.php @@ -14,7 +14,7 @@ * Money * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.0.0 */ class Money { @@ -120,6 +120,8 @@ public function get_cents() { * BHD 3 decimals: 10000 * NLG 4 decimals: 100000 * + * @since 1.2.1 + * * @return int */ public function get_minor_units() { diff --git a/src/Parser.php b/src/Parser.php index 15b0e96..3e4d408 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -14,7 +14,7 @@ * Parser * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.1.0 */ class Parser { diff --git a/src/TaxedMoney.php b/src/TaxedMoney.php index a93b864..ee34c2c 100644 --- a/src/TaxedMoney.php +++ b/src/TaxedMoney.php @@ -14,7 +14,7 @@ * Taxed Money * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.2.0 */ class TaxedMoney extends Money { diff --git a/tests/src/MoneyTest.php b/tests/src/MoneyTest.php index d4e3b3e..f47b468 100644 --- a/tests/src/MoneyTest.php +++ b/tests/src/MoneyTest.php @@ -17,7 +17,7 @@ * Money * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.0.0 */ class MoneyTest extends WP_UnitTestCase { @@ -169,6 +169,8 @@ public function test_cents() { /** * Test minor units. * + * @since 1.2.1 + * * @dataProvider minor_units_provider * * @param string $currency Currency. @@ -183,6 +185,8 @@ public function test_minor_units( $currency, $expected ) { /** * Minor units provider. * + * @since 1.2.1 + * * @return array */ public function minor_units_provider() { diff --git a/tests/src/ParserTest.php b/tests/src/ParserTest.php index d51522b..f39315b 100644 --- a/tests/src/ParserTest.php +++ b/tests/src/ParserTest.php @@ -16,7 +16,7 @@ * Parser * * @author Remco Tolsma - * @version 1.2.0 + * @version 1.2.1 * @since 1.1.0 */ class ParserTest extends WP_UnitTestCase {