Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Aug 5, 2021
2 parents 2e83ecc + 8f64ba2 commit ecd100a
Show file tree
Hide file tree
Showing 29 changed files with 2,256 additions and 2,205 deletions.
38 changes: 3 additions & 35 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,46 +271,14 @@ jobs:
- name: List Composer packages
run: composer show

- name: PHPLint
run: composer run-script phplint

- name: PHPUnit test suite
- name: PHPUnit coverage
env:
WP_TESTS_DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
run: composer run-script phpunit
run: composer run-script coverage

- name: Coveralls code coverage
- name: Publish coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer run-script coveralls
bash <(curl -s https://codecov.io/bash)
es-sass-linting:
name: Scripts and Styles

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# https://github.com/actions/cache/blob/master/examples.md#macos-and-ubuntu
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v1
with:
node-version: '12'

- name: Install Node packages
run: npm install

- name: ESLint
run: npm run-script eslint

- name: Sass Lint
run: npm run-script sass-lint
25 changes: 0 additions & 25 deletions .github/workflows/super-linter.yml

This file was deleted.

34 changes: 20 additions & 14 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
build:
environment:
php: 7.3.0
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"
dependencies:
override:
- composer install --ignore-platform-reqs --no-interaction
nodes:
analysis:
tests:
Expand All @@ -21,11 +8,30 @@ build:
coverage:
tests:
override:
- command: ./vendor/bin/phpunit
- command: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
coverage:
file: build/logs/clover.xml
format: clover

environment:
php: 7.3.0
variables:
WP_TESTS_DB_NAME: 'wp_phpunit_tests'
WP_TESTS_DB_USER: 'root'
WP_TESTS_DB_PASS: ''
WP_TESTS_DB_HOST: '127.0.0.1'

services:
mysql: 5.7

dependencies:
override:
- composer install --ignore-platform-reqs --no-interaction

project_setup:
before:
- mysql -e "CREATE DATABASE wp_phpunit_tests"

checks:
php:
coding_standard:
Expand Down
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## [Unreleased][unreleased]
-

## [2.0.0] - 2021-08-05
### Changed
- Use `pronamic/wp-number` library.
- Simplified JSON, always include currency, without it's just a number value.
- Function `get_minor_units` will now return a `Number` object.
- No longer use i18n in the 'normal' `format()` funciton.
- Validate alphabetic code.

### Added
- Added money amount number format helper functions.
- Added taxed money test.
- Added test for unknown currency.

### Removed
- Removed deprecated `get_cents` function.

## [1.2.6] - 2021-04-26
- Happy 2021.

## [1.2.6] - 2021-01-14
- composer bin all update
- Added GitHub action Super-Linter.
- Fix Psalm issues.
Expand Down Expand Up @@ -51,8 +65,8 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C
## 1.0.0
- First release.

[unreleased]: https://github.com/pronamic/wp-money/compare/1.2.6...HEAD
[1.2.6]: https://github.com/pronamic/wp-money/compare/1.2.5...1.2.6
[unreleased]: https://github.com/pronamic/wp-money/compare/2.0.0...HEAD
[2.0.0]: https://github.com/pronamic/wp-money/compare/1.2.6...2.0.0
[1.2.6]: https://github.com/pronamic/wp-money/compare/1.2.5...1.2.6
[1.2.5]: https://github.com/pronamic/wp-money/compare/1.2.4...1.2.5
[1.2.4]: https://github.com/pronamic/wp-money/compare/1.2.3...1.2.4
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# WordPress Money

[![codecov](https://codecov.io/gh/pronamic/wp-money/branch/develop/graph/badge.svg?token=IqgPWjpzKf)](https://codecov.io/gh/pronamic/wp-money)
[![Coverage Status](https://coveralls.io/repos/github/pronamic/wp-money/badge.svg?branch=develop)](https://coveralls.io/github/pronamic/wp-money?branch=develop)

## Non-breaking space

In the money format it is smart to use a non-breaking space:
Expand Down
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,38 @@
}
],
"require": {
"php": ">=5.6.20"
"php": ">=5.6.20",
"pronamic/wp-number": "^1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"koodimonni-language/de_de": "*",
"koodimonni-language/fr_fr": "*",
"koodimonni-language/nl_nl": "*",
"php-coveralls/php-coveralls": "^2.4",
"phpcompatibility/php-compatibility": "^9.1",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpmd/phpmd": "^2.4",
"phpunit/phpunit": "^5.7 || ^6.0",
"roots/wordpress": "^5.6",
"squizlabs/php_codesniffer": "^3.4",
"pronamic/wp-coding-standards": "^1.0",
"roots/wordpress": "^5.8",
"vlucas/phpdotenv": "^2.0",
"wp-coding-standards/wpcs": "^2.3",
"wp-phpunit/wp-phpunit": "^5.6"
"wp-phpunit/wp-phpunit": "^5.8"
},
"scripts": {
"ci": [
"@phplint",
"@phpcs",
"@coverage",
"@phpstan",
"@psalm"
],
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover build/logs/clover.xml --coverage-text",
"coverage-html": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html build/coverage-html",
"coveralls": "vendor/bin/php-coveralls -v",
"phpcbf":"vendor/bin/phpcbf",
"phpcs": "vendor/bin/phpcs -s -v",
"phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v",
"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",
"phpstan": "vendor/bin/phpstan analyse",
"phpstan": "vendor/bin/phpstan analyse --memory-limit=-1",
"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",
Expand Down
14 changes: 12 additions & 2 deletions docs/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@

### `pronamic_money_default_format`

*Filters the default money format.*

Default format: `%%1$s%%2$s %%3$s`

- 1: Currency symbol
- 2: Amount value
- 3: Currency code

Note: use non-breaking space ` ` in money formatting.

**Arguments**

Argument | Type | Description
-------- | ---- | -----------
`$format` | |
`$format` | `string` | Format.

Source: [src/Money.php](../src/Money.php), [line 75](../src/Money.php#L75-L75)
Source: [src/Money.php](../src/Money.php), [line 59](../src/Money.php#L59-L72)


<p align="center"><a href="https://github.com/pronamic/wp-documentor"><img src="https://cdn.jsdelivr.net/gh/pronamic/wp-documentor@main/logos/pronamic-wp-documentor.svgo-min.svg" alt="Pronamic WordPress Documentor" width="32" height="32"></a><br><em>Generated by <a href="https://github.com/pronamic/wp-documentor">Pronamic WordPress Documentor</a> <code>1.0.0</code></em><p>
Expand Down
18 changes: 18 additions & 0 deletions json-schemas/money.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$id": "https://github.com/pronamic/wp-money/blob/develop/json-schemas/money.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Pronamic WordPress money object.",
"type": "object",
"required": [
"currency",
"amount"
],
"properties": {
"currency": {
"type": "string"
},
"amount": {
"type": ["number", "string"]
}
}
}
26 changes: 26 additions & 0 deletions json-schemas/taxed-money.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$id": "https://github.com/pronamic/wp-money/blob/develop/json-schemas/taxed-money.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Pronamic WordPress taxed money object.",
"type": "object",
"required": [
"currency",
"amount",
"tax_value",
"tax_percentage",
],
"properties": {
"currency": {
"type": "string"
},
"amount": {
"type": ["number", "string"]
},
"tax_value": {
"type": ["number", "string"]
},
"tax_percentage": {
"type": ["number", "string"]
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-money",
"version": "1.2.6",
"version": "2.0.0",
"description": "WordPress Money library.",
"repository": {
"type": "git",
Expand Down
21 changes: 1 addition & 20 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
<?xml version="1.0"?>

<ruleset name="Pronamic Money rules">
<config name="minimum_supported_wp_version" value="4.7" />

<config name="testVersion" value="5.6-" />

<file>.</file>

<arg name="colors"/>
<arg name="extensions" value="php" />
<arg value="sp" />

<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
<exclude-pattern>tests/wp-config.php</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>wordpress/*</exclude-pattern>
<exclude-pattern type="relative">^wp-content/*</exclude-pattern>

<rule ref="PHPCompatibilityWP" />

<rule ref="WordPress">
<exclude name="Generic.Files.LowercasedFilename.NotFound" />

<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
</rule>
<rule ref="PronamicWP" />
</ruleset>
5 changes: 0 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<php>
<env name="WP_PHPUNIT__TESTS_CONFIG" value="tests/wp-config.php" />
</php>
Expand Down
2 changes: 1 addition & 1 deletion pronamic-money.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://www.pronamic.eu/plugins/pronamic-money/
* Description: WordPress Money library.
*
* Version: 1.2.3
* Version: 2.0.0
* Requires at least: 4.7
*
* Author: Pronamic
Expand Down
Loading

0 comments on commit ecd100a

Please sign in to comment.