4 define( 'MEDIAWIKI', true );
6 require 'LocalSettings.php';
7 require_once('includes/LocalisationCache.php');
11 require_ok( 'includes/Defines.php' );
12 require_ok( 'includes/ProfilerStub.php' );
13 require_ok( 'includes/GlobalFunctions.php' );
14 require_ok( 'languages/Language.php' );
15 require_ok( 'includes/Revision.php' );
17 $wgContLang = Language
::factory( 'en' );
18 $wgLegacyEncoding = false;
19 $wgCompressRevisions = false;
20 $wgInputEncoding = 'utf-8';
21 $wgOutputEncoding = 'utf-8';
25 $row->old_text
= 'This is a bunch of revision text.';
26 cmp_ok( Revision
::getRevisionText( $row ), '==',
27 'This is a bunch of revision text.', 'Get revision text' );
30 $row->old_flags
= 'gzip';
31 $row->old_text
= gzdeflate( 'This is a bunch of revision text.' );
32 cmp_ok( Revision
::getRevisionText( $row ), '==',
33 'This is a bunch of revision text.', 'Get revision text with gzip compression' );
35 $wgLegacyEncoding = 'iso-8859-1';
38 $row->old_flags
= 'utf-8';
39 $row->old_text
= "Wiki est l'\xc3\xa9cole superieur !";
40 cmp_ok( Revision
::getRevisionText( $row ), '==',
41 "Wiki est l'\xc3\xa9cole superieur !", 'Get revision text utf-8 native' );
45 $row->old_text
= "Wiki est l'\xe9cole superieur !";
46 cmp_ok( Revision
::getRevisionText( $row ), '==',
47 "Wiki est l'\xc3\xa9cole superieur !", 'Get revision text utf-8 legacy' );
50 $row->old_flags
= 'gzip,utf-8';
51 $row->old_text
= gzdeflate( "Wiki est l'\xc3\xa9cole superieur !" );
52 cmp_ok( Revision
::getRevisionText( $row ), '==',
53 "Wiki est l'\xc3\xa9cole superieur !", 'Get revision text utf-8 native and gzip' );
56 $row->old_flags
= 'gzip';
57 $row->old_text
= gzdeflate( "Wiki est l'\xe9cole superieur !" );
58 cmp_ok( Revision
::getRevisionText( $row ), '==',
59 "Wiki est l'\xc3\xa9cole superieur !", 'Get revision text utf-8 native and gzip' );
62 $row->old_text
= "Wiki est l'\xc3\xa9cole superieur !";
63 $row->old_flags
= Revision
::compressRevisionText( $row->old_text
);
64 like( $row->old_flags
, '/utf-8/', "Flags should contain 'utf-8'" );
65 unlike( $row->old_flags
, '/gzip/', "Flags should not contain 'gzip'" );
66 cmp_ok( $row->old_text
, '==',
67 "Wiki est l'\xc3\xa9cole superieur !", "Direct check" );
68 cmp_ok( Revision
::getRevisionText( $row ), '==',
69 "Wiki est l'\xc3\xa9cole superieur !", "getRevisionText" );
71 $wgCompressRevisions = true;
74 $row->old_text
= "Wiki est l'\xc3\xa9cole superieur !";
75 $row->old_flags
= Revision
::compressRevisionText( $row->old_text
);
76 like( $row->old_flags
, '/utf-8/', "Flags should contain 'utf-8'" );
77 like( $row->old_flags
, '/gzip/', "Flags should contain 'gzip'" );
78 cmp_ok( gzinflate( $row->old_text
), '==',
79 "Wiki est l'\xc3\xa9cole superieur !", "Direct check" );
80 cmp_ok( Revision
::getRevisionText( $row ), '==',
81 "Wiki est l'\xc3\xa9cole superieur !", "getRevisionText" );