Browse Source

Tidying

span
J. King 6 years ago
parent
commit
5217a6c0bc
  1. 5
      README.md
  2. 72
      tests/cases/Encoding/TestGB18030.php
  3. 28
      tests/cases/Encoding/TestUTF8.php
  4. 10
      vendor-bin/csfixer/composer.lock
  5. 10
      vendor-bin/phpunit/composer.lock

5
README.md

@ -5,9 +5,12 @@ While PHP's [internationalization extension][PHP_INTL] offers excellent and exte
Included here is a partial suite of WHATWG-compatible seekable string decoders which are reasonably performant while requiring no external dependencies or PHP extensions. At present it includes the following encodings: Included here is a partial suite of WHATWG-compatible seekable string decoders which are reasonably performant while requiring no external dependencies or PHP extensions. At present it includes the following encodings:
* UTF-8 * UTF-8
* UTF-16
* gb18030 * gb18030
* GBK * GBK
* Big5
* all single-byte encodings * all single-byte encodings
* x-user-defined
Where applicable, code point encoders are also included. In time it will be extended to cover the entire suite of WHATWG character encodings, and may also provide other character-centric internationalization functionality. Where applicable, code point encoders are also included. In time it will be extended to cover the entire suite of WHATWG character encodings, and may also provide other character-centric internationalization functionality.

72
tests/cases/Encoding/TestGB18030.php

@ -137,44 +137,44 @@ class TestGB18030 extends \MensBeam\Intl\Test\CoderDecoderTest {
public function provideCodePoints() { public function provideCodePoints() {
// bytes confirmed using Firefox // bytes confirmed using Firefox
$series_gb18030 = [ $series_gb18030 = [
'U+0064 (HTML)' => [false, 0x64, "64"], 'U+0064 (HTML)' => [false, 0x64, "64"],
'U+0064 (fatal)' => [true, 0x64, "64"], 'U+0064 (fatal)' => [true, 0x64, "64"],
'U+20AC (HTML)' => [false, 0x20AC, "A2 E3"], 'U+20AC (HTML)' => [false, 0x20AC, "A2 E3"],
'U+20AC (fatal)' => [true, 0x20AC, "A2 E3"], 'U+20AC (fatal)' => [true, 0x20AC, "A2 E3"],
'U+2164 (HTML)' => [false, 0x2164, "A2 F5"], 'U+2164 (HTML)' => [false, 0x2164, "A2 F5"],
'U+2164 (fatal)' => [true, 0x2164, "A2 F5"], 'U+2164 (fatal)' => [true, 0x2164, "A2 F5"],
'U+3A74 (HTML)' => [false, 0x3A74, "82 31 97 30"], 'U+3A74 (HTML)' => [false, 0x3A74, "82 31 97 30"],
'U+3A74 (fatal)' => [true, 0x3A74, "82 31 97 30"], 'U+3A74 (fatal)' => [true, 0x3A74, "82 31 97 30"],
'U+E7C7 (HTML)' => [false, 0xE7C7, "81 35 F4 37"], 'U+E7C7 (HTML)' => [false, 0xE7C7, "81 35 F4 37"],
'U+E7C7 (fatal)' => [true, 0xE7C7, "81 35 F4 37"], 'U+E7C7 (fatal)' => [true, 0xE7C7, "81 35 F4 37"],
'U+1D11E (HTML)' => [false, 0x1D11E, "94 32 BE 34"], 'U+1D11E (HTML)' => [false, 0x1D11E, "94 32 BE 34"],
'U+1D11E (fatal)' => [true, 0x1D11E, "94 32 BE 34"], 'U+1D11E (fatal)' => [true, 0x1D11E, "94 32 BE 34"],
'U+E5E5 (HTML)' => [false, 0xE5E5, bin2hex("")], 'U+E5E5 (HTML)' => [false, 0xE5E5, bin2hex("")],
'U+E5E5 (fatal)' => [true, 0xE5E5, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)], 'U+E5E5 (fatal)' => [true, 0xE5E5, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)],
'-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'U+110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'U+110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
]; ];
$series_gbk = [ $series_gbk = [
'U+0064 (HTML)' => [false, 0x64, "64"], 'U+0064 (HTML)' => [false, 0x64, "64"],
'U+0064 (fatal)' => [true, 0x64, "64"], 'U+0064 (fatal)' => [true, 0x64, "64"],
'U+20AC (HTML)' => [false, 0x20AC, "80"], 'U+20AC (HTML)' => [false, 0x20AC, "80"],
'U+20AC (fatal)' => [true, 0x20AC, "80"], 'U+20AC (fatal)' => [true, 0x20AC, "80"],
'U+2164 (HTML)' => [false, 0x2164, "A2 F5"], 'U+2164 (HTML)' => [false, 0x2164, "A2 F5"],
'U+2164 (fatal)' => [true, 0x2164, "A2 F5"], 'U+2164 (fatal)' => [true, 0x2164, "A2 F5"],
'U+3A74 (HTML)' => [false, 0x3A74, bin2hex("㩴")], 'U+3A74 (HTML)' => [false, 0x3A74, bin2hex("㩴")],
'U+3A74 (fatal)' => [true, 0x3A74, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)], 'U+3A74 (fatal)' => [true, 0x3A74, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)],
'U+E7C7 (HTML)' => [false, 0xE7C7, bin2hex("")], 'U+E7C7 (HTML)' => [false, 0xE7C7, bin2hex("")],
'U+E7C7 (fatal)' => [true, 0xE7C7, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)], 'U+E7C7 (fatal)' => [true, 0xE7C7, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)],
'U+1D11E (HTML)' => [false, 0x1D11E, bin2hex("𝄞")], 'U+1D11E (HTML)' => [false, 0x1D11E, bin2hex("𝄞")],
'U+1D11E (fatal)' => [true, 0x1D11E, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)], 'U+1D11E (fatal)' => [true, 0x1D11E, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)],
'U+E5E5 (HTML)' => [false, 0xE5E5, bin2hex("")], 'U+E5E5 (HTML)' => [false, 0xE5E5, bin2hex("")],
'U+E5E5 (fatal)' => [true, 0xE5E5, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)], 'U+E5E5 (fatal)' => [true, 0xE5E5, new EncoderException("", Encoding::E_UNAVAILABLE_CODE_POINT)],
'-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'U+110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'U+110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
]; ];
foreach ($series_gb18030 as $name => $test) { foreach ($series_gb18030 as $name => $test) {
array_push($test, GB18030::class); array_push($test, GB18030::class);

28
tests/cases/Encoding/TestUTF8.php

@ -128,22 +128,22 @@ class TestUTF8 extends \MensBeam\Intl\Test\CoderDecoderTest {
public function provideCodePoints() { public function provideCodePoints() {
return [ return [
'U+007A (HTML)' => [false, 0x7A, "7A"], 'U+007A (HTML)' => [false, 0x7A, "7A"],
'U+007A (fatal)' => [true, 0x7A, "7A"], 'U+007A (fatal)' => [true, 0x7A, "7A"],
'U+00A2 (HTML)' => [false, 0xA2, "C2 A2"], 'U+00A2 (HTML)' => [false, 0xA2, "C2 A2"],
'U+00A2 (fatal)' => [true, 0xA2, "C2 A2"], 'U+00A2 (fatal)' => [true, 0xA2, "C2 A2"],
'U+6C34 (HTML)' => [false, 0x6C34, "E6 B0 B4"], 'U+6C34 (HTML)' => [false, 0x6C34, "E6 B0 B4"],
'U+6C34 (fatal)' => [true, 0x6C34, "E6 B0 B4"], 'U+6C34 (fatal)' => [true, 0x6C34, "E6 B0 B4"],
'U+1D11E (HTML)' => [false, 0x1D11E, "F0 9D 84 9E"], 'U+1D11E (HTML)' => [false, 0x1D11E, "F0 9D 84 9E"],
'U+1D11E (fatal)' => [true, 0x1D11E, "F0 9D 84 9E"], 'U+1D11E (fatal)' => [true, 0x1D11E, "F0 9D 84 9E"],
'U+F8FF (HTML)' => [false, 0xF8FF, "EF A3 BF"], 'U+F8FF (HTML)' => [false, 0xF8FF, "EF A3 BF"],
'U+F8FF (fatal)' => [true, 0xF8FF, "EF A3 BF"], 'U+F8FF (fatal)' => [true, 0xF8FF, "EF A3 BF"],
'U+10FFFD (HTML)' => [false, 0x10FFFD, "F4 8F BF BD"], 'U+10FFFD (HTML)' => [false, 0x10FFFD, "F4 8F BF BD"],
'U+10FFFD (fatal)' => [true, 0x10FFFD, "F4 8F BF BD"], 'U+10FFFD (fatal)' => [true, 0x10FFFD, "F4 8F BF BD"],
'U+FFFE (HTML)' => [false, 0xFFFE, "EF BF BE"], 'U+FFFE (HTML)' => [false, 0xFFFE, "EF BF BE"],
'U+FFFE (fatal)' => [true, 0xFFFE, "EF BF BE"], 'U+FFFE (fatal)' => [true, 0xFFFE, "EF BF BE"],
'-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (HTML)' => [false, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '-1 (fatal)' => [true, -1, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'0x110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (HTML)' => [false, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
'0x110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)], '0x110000 (fatal)' => [true, 0x110000, new EncoderException("", Encoding::E_INVALID_CODE_POINT)],
]; ];

10
vendor-bin/csfixer/composer.lock

@ -70,16 +70,16 @@
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
"version": "1.2.1", "version": "1.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/xdebug-handler.git", "url": "https://github.com/composer/xdebug-handler.git",
"reference": "e37cbd80da64afe314c72de8d2d2fec0e40d9373" "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/e37cbd80da64afe314c72de8d2d2fec0e40d9373", "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/b8e9745fb9b06ea6664d8872c4505fb16df4611c",
"reference": "e37cbd80da64afe314c72de8d2d2fec0e40d9373", "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -110,7 +110,7 @@
"Xdebug", "Xdebug",
"performance" "performance"
], ],
"time": "2018-08-23T12:00:19+00:00" "time": "2018-08-31T19:07:57+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",

10
vendor-bin/phpunit/composer.lock

@ -673,16 +673,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "6.5.12", "version": "6.5.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "24da433d7384824d65ea93fbb462e2f31bbb494e" "reference": "0973426fb012359b2f18d3bd1e90ef1172839693"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/24da433d7384824d65ea93fbb462e2f31bbb494e", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693",
"reference": "24da433d7384824d65ea93fbb462e2f31bbb494e", "reference": "0973426fb012359b2f18d3bd1e90ef1172839693",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -753,7 +753,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2018-08-22T06:32:48+00:00" "time": "2018-09-08T15:10:43+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",

Loading…
Cancel
Save