@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | // WARNING WARNING WARNING! |
| 31 | 31 | // These tests will DROP ALL TABLES in the database with the prefix named below. |
| 32 | 32 | // DO NOT use a production database or one that is shared with something else. |
| 33 | -define( 'DB_NAME' , getenv( 'WP_TESTS_DB_NAME' ) ?: 'wp_phpunit_tests' ); |
|
| 34 | -define( 'DB_USER' , getenv( 'WP_TESTS_DB_USER' ) ?: 'root' ); |
|
| 35 | -define( 'DB_PASSWORD' , getenv( 'WP_TESTS_DB_PASS' ) ?: '' ); |
|
| 36 | -define( 'DB_HOST' , getenv( 'WP_TESTS_DB_HOST' ) ?: 'localhost' ); |
|
| 37 | -define( 'DB_CHARSET' , 'utf8' ); |
|
| 38 | -define( 'DB_COLLATE' , '' ); |
|
| 33 | +define( 'DB_NAME', getenv( 'WP_TESTS_DB_NAME' ) ?: 'wp_phpunit_tests' ); |
|
| 34 | +define( 'DB_USER', getenv( 'WP_TESTS_DB_USER' ) ?: 'root' ); |
|
| 35 | +define( 'DB_PASSWORD', getenv( 'WP_TESTS_DB_PASS' ) ?: '' ); |
|
| 36 | +define( 'DB_HOST', getenv( 'WP_TESTS_DB_HOST' ) ?: 'localhost' ); |
|
| 37 | +define( 'DB_CHARSET', 'utf8' ); |
|
| 38 | +define( 'DB_COLLATE', '' ); |
|
| 39 | 39 | |
| 40 | 40 | /**#@+ |
| 41 | 41 | * Authentication Unique Keys and Salts. |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * Change these to different unique phrases! |
| 44 | 44 | * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} |
| 45 | 45 | */ |
| 46 | -define( 'AUTH_KEY', 'put your unique phrase here' ); |
|
| 47 | -define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); |
|
| 48 | -define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); |
|
| 49 | -define( 'NONCE_KEY', 'put your unique phrase here' ); |
|
| 50 | -define( 'AUTH_SALT', 'put your unique phrase here' ); |
|
| 46 | +define( 'AUTH_KEY', 'put your unique phrase here' ); |
|
| 47 | +define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); |
|
| 48 | +define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); |
|
| 49 | +define( 'NONCE_KEY', 'put your unique phrase here' ); |
|
| 50 | +define( 'AUTH_SALT', 'put your unique phrase here' ); |
|
| 51 | 51 | define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); |
| 52 | -define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); |
|
| 53 | -define( 'NONCE_SALT', 'put your unique phrase here' ); |
|
| 52 | +define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); |
|
| 53 | +define( 'NONCE_SALT', 'put your unique phrase here' ); |
|
| 54 | 54 | |
| 55 | 55 | define( 'WP_TESTS_DOMAIN', 'example.org' ); |
| 56 | 56 | define( 'WP_TESTS_EMAIL', '[email protected]' ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $currencies = self::get_currencies(); |
| 52 | 52 | |
| 53 | 53 | if ( \array_key_exists( $alphabetic_code, $currencies ) ) { |
| 54 | - return $currencies[ $alphabetic_code ]; |
|
| 54 | + return $currencies[$alphabetic_code]; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return new Currency( $alphabetic_code ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | foreach ( $data as $currency ) { |
| 86 | 86 | $alphabetic_code = $currency->get_alphabetic_code(); |
| 87 | 87 | |
| 88 | - $currencies[ $alphabetic_code ] = $currency; |
|
| 88 | + $currencies[$alphabetic_code] = $currency; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $currencies; |
@@ -75,73 +75,73 @@ |
||
| 75 | 75 | public function string_to_amount_provider() { |
| 76 | 76 | return [ |
| 77 | 77 | // Thousands separator is '' and decimal separator is '.'. |
| 78 | - [ '', '.', '1', 1 ], |
|
| 79 | - [ '', '.', '2,5', 2.5 ], |
|
| 80 | - [ '', '.', '2,50', 2.5 ], |
|
| 81 | - [ '', '.', '1250,00', 1250 ], |
|
| 82 | - [ '', '.', '1250,75', 1250.75 ], |
|
| 83 | - [ '', '.', '1250.75', 1250.75 ], |
|
| 84 | - [ '', '.', '1.250,00', 1250 ], |
|
| 85 | - [ '', '.', '2.500,75', 2500.75 ], |
|
| 86 | - [ '', '.', '2500,75-', -2500.75 ], |
|
| 87 | - [ '', '.', '-2500,75', -2500.75 ], |
|
| 88 | - [ '', '.', '2500-', -2500 ], |
|
| 89 | - [ '', '.', '-2500', -2500 ], |
|
| 90 | - [ '', '.', '1-', -1 ], |
|
| 78 | + ['', '.', '1', 1], |
|
| 79 | + ['', '.', '2,5', 2.5], |
|
| 80 | + ['', '.', '2,50', 2.5], |
|
| 81 | + ['', '.', '1250,00', 1250], |
|
| 82 | + ['', '.', '1250,75', 1250.75], |
|
| 83 | + ['', '.', '1250.75', 1250.75], |
|
| 84 | + ['', '.', '1.250,00', 1250], |
|
| 85 | + ['', '.', '2.500,75', 2500.75], |
|
| 86 | + ['', '.', '2500,75-', -2500.75], |
|
| 87 | + ['', '.', '-2500,75', -2500.75], |
|
| 88 | + ['', '.', '2500-', -2500], |
|
| 89 | + ['', '.', '-2500', -2500], |
|
| 90 | + ['', '.', '1-', -1], |
|
| 91 | 91 | // Thousands separator is '.' and decimal separator is ','. |
| 92 | - [ '.', ',', '1', 1 ], |
|
| 93 | - [ '.', ',', '2,5', 2.5 ], |
|
| 94 | - [ '.', ',', '2,50', 2.5 ], |
|
| 95 | - [ '.', ',', '1250,00', 1250 ], |
|
| 96 | - [ '.', ',', '2500,75', 2500.75 ], |
|
| 97 | - [ '.', ',', '1.250,00', 1250 ], |
|
| 98 | - [ '.', ',', '2.500,75', 2500.75 ], |
|
| 99 | - [ '.', ',', '2.500,750', 2500.75 ], |
|
| 100 | - [ '.', ',', '1.234.567.890', 1234567890 ], |
|
| 101 | - [ '.', ',', '2.500,75-', -2500.75 ], |
|
| 102 | - [ '.', ',', '-2.500,75', -2500.75 ], |
|
| 103 | - [ '.', ',', '2.500-', -2500 ], |
|
| 104 | - [ '.', ',', '-2.500', -2500 ], |
|
| 105 | - [ '.', ',', '1-', -1 ], |
|
| 92 | + ['.', ',', '1', 1], |
|
| 93 | + ['.', ',', '2,5', 2.5], |
|
| 94 | + ['.', ',', '2,50', 2.5], |
|
| 95 | + ['.', ',', '1250,00', 1250], |
|
| 96 | + ['.', ',', '2500,75', 2500.75], |
|
| 97 | + ['.', ',', '1.250,00', 1250], |
|
| 98 | + ['.', ',', '2.500,75', 2500.75], |
|
| 99 | + ['.', ',', '2.500,750', 2500.75], |
|
| 100 | + ['.', ',', '1.234.567.890', 1234567890], |
|
| 101 | + ['.', ',', '2.500,75-', -2500.75], |
|
| 102 | + ['.', ',', '-2.500,75', -2500.75], |
|
| 103 | + ['.', ',', '2.500-', -2500], |
|
| 104 | + ['.', ',', '-2.500', -2500], |
|
| 105 | + ['.', ',', '1-', -1], |
|
| 106 | 106 | // Thousands separator is ',' and decimal separator is '.'. |
| 107 | - [ ',', '.', '1', 1 ], |
|
| 108 | - [ ',', '.', '2.5', 2.5 ], |
|
| 109 | - [ ',', '.', '2.50', 2.5 ], |
|
| 110 | - [ ',', '.', '1250.00', 1250 ], |
|
| 111 | - [ ',', '.', '1250.75', 1250.75 ], |
|
| 112 | - [ ',', '.', '1,250.00', 1250 ], |
|
| 113 | - [ ',', '.', '2,500.75', 2500.75 ], |
|
| 114 | - [ ',', '.', '2,500.', 2500 ], |
|
| 115 | - [ ',', '.', '2,500.75-', -2500.75 ], |
|
| 116 | - [ ',', '.', '-2,500.75', -2500.75 ], |
|
| 117 | - [ ',', '.', '2,500-', -2500 ], |
|
| 118 | - [ ',', '.', '-2,500', -2500 ], |
|
| 119 | - [ ',', '.', '1-', -1 ], |
|
| 107 | + [',', '.', '1', 1], |
|
| 108 | + [',', '.', '2.5', 2.5], |
|
| 109 | + [',', '.', '2.50', 2.5], |
|
| 110 | + [',', '.', '1250.00', 1250], |
|
| 111 | + [',', '.', '1250.75', 1250.75], |
|
| 112 | + [',', '.', '1,250.00', 1250], |
|
| 113 | + [',', '.', '2,500.75', 2500.75], |
|
| 114 | + [',', '.', '2,500.', 2500], |
|
| 115 | + [',', '.', '2,500.75-', -2500.75], |
|
| 116 | + [',', '.', '-2,500.75', -2500.75], |
|
| 117 | + [',', '.', '2,500-', -2500], |
|
| 118 | + [',', '.', '-2,500', -2500], |
|
| 119 | + [',', '.', '1-', -1], |
|
| 120 | 120 | // Thousands separator is ' ' and decimal separator is '.'. |
| 121 | - [ ' ', '.', '2 500.75', 2500.75 ], |
|
| 121 | + [' ', '.', '2 500.75', 2500.75], |
|
| 122 | 122 | // Thousands separator is 't' and decimal separator is '.'. |
| 123 | - [ 't', '.', '2t500.75', 2500.75 ], |
|
| 124 | - [ 't', '.', '2t500.7', 2500.7 ], |
|
| 123 | + ['t', '.', '2t500.75', 2500.75], |
|
| 124 | + ['t', '.', '2t500.7', 2500.7], |
|
| 125 | 125 | // Thousands separator is 't' and decimal separator is '-'. |
| 126 | - [ 't', '-', '2t500-75', 2500.75 ], |
|
| 127 | - [ 't', '-', '2t500-7', 2500.7 ], |
|
| 126 | + ['t', '-', '2t500-75', 2500.75], |
|
| 127 | + ['t', '-', '2t500-7', 2500.7], |
|
| 128 | 128 | // Thousands separator is 't' and decimal separator is ' '. |
| 129 | - [ 't', ' ', '2t500 75', 2500.75 ], |
|
| 130 | - [ 't', ' ', '2t500 7', 2500.7 ], |
|
| 129 | + ['t', ' ', '2t500 75', 2500.75], |
|
| 130 | + ['t', ' ', '2t500 7', 2500.7], |
|
| 131 | 131 | // Thousands separator is ' ' and decimal separator is 'd'. |
| 132 | - [ ' ', 'd', '2 500d75', 2500.75 ], |
|
| 133 | - [ ' ', 'd', '2 500d7', 2500.7 ], |
|
| 134 | - [ ' ', 'd', '-2 500d75', -2500.75 ], |
|
| 135 | - [ ' ', 'd', '-2 500d7', -2500.7 ], |
|
| 132 | + [' ', 'd', '2 500d75', 2500.75], |
|
| 133 | + [' ', 'd', '2 500d7', 2500.7], |
|
| 134 | + [' ', 'd', '-2 500d75', -2500.75], |
|
| 135 | + [' ', 'd', '-2 500d7', -2500.7], |
|
| 136 | 136 | // Other. |
| 137 | - [ '.', ',', 'EUR 1.250', 1250 ], |
|
| 138 | - [ '.', ',', 'EUR 1.250,75', 1250.75 ], |
|
| 139 | - [ '.', ',', 'EUR -1.250', -1250 ], |
|
| 140 | - [ '.', ',', 'EUR -1.250,75', -1250.75 ], |
|
| 141 | - [ '.', ',', '1.250,-', 1250 ], |
|
| 142 | - [ '.', ',', '-1.250,-', -1250 ], |
|
| 143 | - [ '', '', '123456789', 123456789 ], |
|
| 144 | - [ false, false, '123 456 789', 123456789 ], |
|
| 137 | + ['.', ',', 'EUR 1.250', 1250], |
|
| 138 | + ['.', ',', 'EUR 1.250,75', 1250.75], |
|
| 139 | + ['.', ',', 'EUR -1.250', -1250], |
|
| 140 | + ['.', ',', 'EUR -1.250,75', -1250.75], |
|
| 141 | + ['.', ',', '1.250,-', 1250], |
|
| 142 | + ['.', ',', '-1.250,-', -1250], |
|
| 143 | + ['', '', '123456789', 123456789], |
|
| 144 | + [false, false, '123 456 789', 123456789], |
|
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | parent::setUp(); |
| 29 | 29 | |
| 30 | 30 | if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { |
| 31 | - add_filter( 'number_format_i18n', [ $this, 'maybe_fix_multibyte_number_format' ], 10, 3 ); |
|
| 31 | + add_filter( 'number_format_i18n', [$this, 'maybe_fix_multibyte_number_format'], 10, 3 ); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function default_format_provider() { |
| 99 | 99 | return [ |
| 100 | - [ 'en_US', '%1$s%2$s %3$s' ], |
|
| 101 | - [ 'fr_FR', '%1$s%2$s %3$s' ], |
|
| 102 | - [ 'nl_NL', '%1$s %2$s' ], |
|
| 100 | + ['en_US', '%1$s%2$s %3$s'], |
|
| 101 | + ['fr_FR', '%1$s%2$s %3$s'], |
|
| 102 | + ['nl_NL', '%1$s %2$s'], |
|
| 103 | 103 | ]; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | public function format_i18n_provider() { |
| 136 | 136 | return [ |
| 137 | 137 | // Dutch. |
| 138 | - [ 'nl_NL', 'EUR', 49.7512, '€ 49,75' ], |
|
| 139 | - [ 'nl_NL', 'NLG', 49.7512, 'G 49,7512' ], |
|
| 140 | - [ 'nl_NL', 'USD', 49.7512, '$ 49,75' ], |
|
| 141 | - [ 'nl_NL', 'USD', 1234567890.1234, '$ 1.234.567.890,12' ], |
|
| 138 | + ['nl_NL', 'EUR', 49.7512, '€ 49,75'], |
|
| 139 | + ['nl_NL', 'NLG', 49.7512, 'G 49,7512'], |
|
| 140 | + ['nl_NL', 'USD', 49.7512, '$ 49,75'], |
|
| 141 | + ['nl_NL', 'USD', 1234567890.1234, '$ 1.234.567.890,12'], |
|
| 142 | 142 | |
| 143 | 143 | // English. |
| 144 | - [ 'en_US', 'EUR', 49.7512, '€49.75 EUR' ], |
|
| 145 | - [ 'en_US', 'USD', 1234567890.1234, '$1,234,567,890.12 USD' ], |
|
| 144 | + ['en_US', 'EUR', 49.7512, '€49.75 EUR'], |
|
| 145 | + ['en_US', 'USD', 1234567890.1234, '$1,234,567,890.12 USD'], |
|
| 146 | 146 | |
| 147 | 147 | // French. |
| 148 | - [ 'fr_FR', 'USD', 1234567890.1234, '$1 234 567 890,12 USD' ], |
|
| 148 | + ['fr_FR', 'USD', 1234567890.1234, '$1 234 567 890,12 USD'], |
|
| 149 | 149 | ]; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -182,17 +182,17 @@ discard block |
||
| 182 | 182 | public function format_i18n_non_trailing_zeros_provider() { |
| 183 | 183 | return [ |
| 184 | 184 | // Dutch. |
| 185 | - [ 'nl_NL', 'EUR', 49.7512, '€ 49,75' ], |
|
| 186 | - [ 'nl_NL', 'NLG', 49, 'G 49' ], |
|
| 187 | - [ 'nl_NL', 'USD', 49.00, '$ 49' ], |
|
| 188 | - [ 'nl_NL', 'USD', 1234567890.00, '$ 1.234.567.890' ], |
|
| 185 | + ['nl_NL', 'EUR', 49.7512, '€ 49,75'], |
|
| 186 | + ['nl_NL', 'NLG', 49, 'G 49'], |
|
| 187 | + ['nl_NL', 'USD', 49.00, '$ 49'], |
|
| 188 | + ['nl_NL', 'USD', 1234567890.00, '$ 1.234.567.890'], |
|
| 189 | 189 | |
| 190 | 190 | // English. |
| 191 | - [ 'en_US', 'EUR', 49.7512, '€49.75 EUR' ], |
|
| 192 | - [ 'en_US', 'USD', 1234567890.00, '$1,234,567,890 USD' ], |
|
| 191 | + ['en_US', 'EUR', 49.7512, '€49.75 EUR'], |
|
| 192 | + ['en_US', 'USD', 1234567890.00, '$1,234,567,890 USD'], |
|
| 193 | 193 | |
| 194 | 194 | // French. |
| 195 | - [ 'fr_FR', 'USD', 1234567890, '$1 234 567 890 USD' ], |
|
| 195 | + ['fr_FR', 'USD', 1234567890, '$1 234 567 890 USD'], |
|
| 196 | 196 | ]; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -223,28 +223,28 @@ discard block |
||
| 223 | 223 | public function minor_units_provider() { |
| 224 | 224 | return [ |
| 225 | 225 | // Value 10. |
| 226 | - [ 'JPY', 10, 10 ], |
|
| 227 | - [ 'EUR', 10, 1000 ], |
|
| 228 | - [ 'BHD', 10, 10000 ], |
|
| 229 | - [ 'NLG', 10, 100000 ], |
|
| 226 | + ['JPY', 10, 10], |
|
| 227 | + ['EUR', 10, 1000], |
|
| 228 | + ['BHD', 10, 10000], |
|
| 229 | + ['NLG', 10, 100000], |
|
| 230 | 230 | |
| 231 | 231 | // Value 100.65. |
| 232 | - [ 'JPY', 100.65, 100 ], |
|
| 233 | - [ 'EUR', 100.65, 10065 ], |
|
| 234 | - [ 'BHD', 100.65, 100650 ], |
|
| 235 | - [ 'NLG', 100.65, 1006500 ], |
|
| 232 | + ['JPY', 100.65, 100], |
|
| 233 | + ['EUR', 100.65, 10065], |
|
| 234 | + ['BHD', 100.65, 100650], |
|
| 235 | + ['NLG', 100.65, 1006500], |
|
| 236 | 236 | |
| 237 | 237 | // Value 100.655. |
| 238 | - [ 'JPY', 100.655, 100 ], |
|
| 239 | - [ 'EUR', 100.655, 10065 ], |
|
| 240 | - [ 'BHD', 100.655, 100655 ], |
|
| 241 | - [ 'NLG', 100.655, 1006550 ], |
|
| 238 | + ['JPY', 100.655, 100], |
|
| 239 | + ['EUR', 100.655, 10065], |
|
| 240 | + ['BHD', 100.655, 100655], |
|
| 241 | + ['NLG', 100.655, 1006550], |
|
| 242 | 242 | |
| 243 | 243 | // Value 0.00010. |
| 244 | - [ 'JPY', 0.00010, 0 ], |
|
| 245 | - [ 'EUR', 0.00010, 0 ], |
|
| 246 | - [ 'BHD', 0.00010, 0 ], |
|
| 247 | - [ 'NLG', 0.00010, 1 ], |
|
| 244 | + ['JPY', 0.00010, 0], |
|
| 245 | + ['EUR', 0.00010, 0], |
|
| 246 | + ['BHD', 0.00010, 0], |
|
| 247 | + ['NLG', 0.00010, 1], |
|
| 248 | 248 | ]; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | $decimal_sep = $wp_locale->number_format['decimal_point']; |
| 38 | 38 | |
| 39 | 39 | // Separators. |
| 40 | - $separators = [ $decimal_sep, '.', ',' ]; |
|
| 40 | + $separators = [$decimal_sep, '.', ',']; |
|
| 41 | 41 | $separators = array_unique( array_filter( $separators ) ); |
| 42 | 42 | |
| 43 | 43 | // Check. |
| 44 | - foreach ( [ - 3, - 2 ] as $i ) { |
|
| 44 | + foreach ( [ - 3, - 2] as $i ) { |
|
| 45 | 45 | $test = substr( $string, $i, 1 ); |
| 46 | 46 | |
| 47 | 47 | if ( in_array( $test, $separators, true ) ) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @link https://taaladvies.net/taal/advies/vraag/275/euro_komma_en_streepje_in_de_notatie_van_hele_bedragen/ |
| 78 | 78 | */ |
| 79 | - if ( \in_array( $half, [ '-', '–', '—' ], true ) ) { |
|
| 79 | + if ( \in_array( $half, ['-', '–', '—'], true ) ) { |
|
| 80 | 80 | $half = ''; |
| 81 | 81 | } |
| 82 | 82 | |