MediaWiki  1.23.1
MWMessagePackTest.php
Go to the documentation of this file.
1 <?php
7 
16  public function provider() {
17  return array(
18  array( 'nil', null, 'c0' ),
19  array( 'bool', true, 'c3' ),
20  array( 'bool', false, 'c2' ),
21  array( 'positive fixnum', 0, '00' ),
22  array( 'positive fixnum', 1, '01' ),
23  array( 'positive fixnum', 5, '05' ),
24  array( 'positive fixnum', 35, '23' ),
25  array( 'uint 8', 128, 'cc80' ),
26  array( 'uint 16', 1000, 'cd03e8' ),
27  array( 'uint 32', 100000, 'ce000186a0' ),
28  array( 'uint 64', 10000000000, 'cf00000002540be400' ),
29  array( 'negative fixnum', -1, 'ff' ),
30  array( 'negative fixnum', -2, 'fe' ),
31  array( 'int 8', -128, 'd080' ),
32  array( 'int 8', -35, 'd0dd' ),
33  array( 'int 16', -1000, 'd1fc18' ),
34  array( 'int 32', -100000, 'd2fffe7960' ),
35  array( 'int 64', -10000000000, 'd3fffffffdabf41c00' ),
36  array( 'int 64', -223372036854775807, 'd3fce66c50e2840001' ),
37  array( 'int 64', -9223372036854775807, 'd38000000000000001' ),
38  array( 'double', 0.1, 'cb3fb999999999999a' ),
39  array( 'double', 1.1, 'cb3ff199999999999a' ),
40  array( 'double', 123.456, 'cb405edd2f1a9fbe77' ),
41  array( 'fix raw', '', 'a0' ),
42  array( 'fix raw', 'foobar', 'a6666f6f626172' ),
43  array(
44  'raw 16',
45  'Lorem ipsum dolor sit amet amet.',
46  'da00204c6f72656d20697073756d20646f6c6f722073697420616d657420616d65742e'
47  ),
48  array(
49  'fix array',
50  array( 'abc', 'def', 'ghi' ),
51  '93a3616263a3646566a3676869'
52  ),
53  array(
54  'fix map',
55  array( 'one' => 1, 'two' => 2 ),
56  '82a36f6e6501a374776f02'
57  ),
58  );
59  }
60 
66  public function testPack( $type, $value, $expected ) {
67  $actual = bin2hex( MWMessagePack::pack( $value ) );
68  $this->assertEquals( $actual, $expected, $type );
69  }
70 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
MWMessagePackTest
PHP Unit tests for MWMessagePack @covers MWMessagePack.
Definition: MWMessagePackTest.php:6
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
$value
$value
Definition: styleTest.css.php:45
MWMessagePack\pack
static pack( $value)
Encode a value using MessagePack.
Definition: MWMessagePack.php:51
MWMessagePackTest\testPack
testPack( $type, $value, $expected)
Verify that values are serialized correctly.
Definition: MWMessagePackTest.php:66
MWMessagePackTest\provider
provider()
Provides test cases for MWMessagePackTest::testMessagePack.
Definition: MWMessagePackTest.php:16
$type
$type
Definition: testCompression.php:46