X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flibs%2FMWMessagePackTest.php;h=695a73415308652b9ead2651b02663bd27c1b8e3;hb=8624538de243da3779db5eb3362bedf78d2e2931;hp=ec145836bd8d4af00b98a97a506f11d489e20d80;hpb=44aec8a00a9f0f92a746ca575b58147fea1135e5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/libs/MWMessagePackTest.php b/tests/phpunit/includes/libs/MWMessagePackTest.php index ec145836bd..695a734153 100644 --- a/tests/phpunit/includes/libs/MWMessagePackTest.php +++ b/tests/phpunit/includes/libs/MWMessagePackTest.php @@ -3,7 +3,9 @@ * PHP Unit tests for MWMessagePack * @covers MWMessagePack */ -class MWMessagePackTest extends PHPUnit_Framework_TestCase { +class MWMessagePackTest extends PHPUnit\Framework\TestCase { + + use MediaWikiCoversValidator; /** * Provides test cases for MWMessagePackTest::testMessagePack @@ -14,50 +16,50 @@ class MWMessagePackTest extends PHPUnit_Framework_TestCase { * serialization function. */ public static function providePacks() { - $tests = array( - array( 'nil', null, 'c0' ), - array( 'bool', true, 'c3' ), - array( 'bool', false, 'c2' ), - array( 'positive fixnum', 0, '00' ), - array( 'positive fixnum', 1, '01' ), - array( 'positive fixnum', 5, '05' ), - array( 'positive fixnum', 35, '23' ), - array( 'uint 8', 128, 'cc80' ), - array( 'uint 16', 1000, 'cd03e8' ), - array( 'uint 32', 100000, 'ce000186a0' ), - array( 'negative fixnum', -1, 'ff' ), - array( 'negative fixnum', -2, 'fe' ), - array( 'int 8', -128, 'd080' ), - array( 'int 8', -35, 'd0dd' ), - array( 'int 16', -1000, 'd1fc18' ), - array( 'int 32', -100000, 'd2fffe7960' ), - array( 'double', 0.1, 'cb3fb999999999999a' ), - array( 'double', 1.1, 'cb3ff199999999999a' ), - array( 'double', 123.456, 'cb405edd2f1a9fbe77' ), - array( 'fix raw', '', 'a0' ), - array( 'fix raw', 'foobar', 'a6666f6f626172' ), - array( + $tests = [ + [ 'nil', null, 'c0' ], + [ 'bool', true, 'c3' ], + [ 'bool', false, 'c2' ], + [ 'positive fixnum', 0, '00' ], + [ 'positive fixnum', 1, '01' ], + [ 'positive fixnum', 5, '05' ], + [ 'positive fixnum', 35, '23' ], + [ 'uint 8', 128, 'cc80' ], + [ 'uint 16', 1000, 'cd03e8' ], + [ 'uint 32', 100000, 'ce000186a0' ], + [ 'negative fixnum', -1, 'ff' ], + [ 'negative fixnum', -2, 'fe' ], + [ 'int 8', -128, 'd080' ], + [ 'int 8', -35, 'd0dd' ], + [ 'int 16', -1000, 'd1fc18' ], + [ 'int 32', -100000, 'd2fffe7960' ], + [ 'double', 0.1, 'cb3fb999999999999a' ], + [ 'double', 1.1, 'cb3ff199999999999a' ], + [ 'double', 123.456, 'cb405edd2f1a9fbe77' ], + [ 'fix raw', '', 'a0' ], + [ 'fix raw', 'foobar', 'a6666f6f626172' ], + [ 'raw 16', 'Lorem ipsum dolor sit amet amet.', 'da00204c6f72656d20697073756d20646f6c6f722073697420616d657420616d65742e' - ), - array( + ], + [ 'fix array', - array( 'abc', 'def', 'ghi' ), + [ 'abc', 'def', 'ghi' ], '93a3616263a3646566a3676869' - ), - array( + ], + [ 'fix map', - array( 'one' => 1, 'two' => 2 ), + [ 'one' => 1, 'two' => 2 ], '82a36f6e6501a374776f02' - ), - ); + ], + ]; if ( PHP_INT_SIZE > 4 ) { - $tests[] = array( 'uint 64', 10000000000, 'cf00000002540be400' ); - $tests[] = array( 'int 64', -10000000000, 'd3fffffffdabf41c00' ); - $tests[] = array( 'int 64', -223372036854775807, 'd3fce66c50e2840001' ); - $tests[] = array( 'int 64', -9223372036854775807, 'd38000000000000001' ); + $tests[] = [ 'uint 64', 10000000000, 'cf00000002540be400' ]; + $tests[] = [ 'int 64', -10000000000, 'd3fffffffdabf41c00' ]; + $tests[] = [ 'int 64', -223372036854775807, 'd3fce66c50e2840001' ]; + $tests[] = [ 'int 64', -9223372036854775807, 'd38000000000000001' ]; } return $tests;