Fixed fatal error by defineing a blank function in parent class
[mediawiki.git] / t / inc / Revision.t
blob5ee0b163abce1a67ce3cee8f71c4a7f22b28780a
1 #!/usr/bin/env php
2 <?php
4 define( 'MEDIAWIKI', true );
5 require 't/Test.php';
6 require 'LocalSettings.php';
7 require_once('includes/LocalisationCache.php');
9 plan( 19 );
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';
23 $row = new stdClass;
24 $row->old_flags = '';
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' );
29 $row = new stdClass;
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';
37 $row = new stdClass;
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' );
43 $row = new stdClass;
44 $row->old_flags = '';
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' );
49 $row = new stdClass;
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' );
55 $row = new stdClass;
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' );
61 $row = new stdClass;
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;
73 $row = new stdClass;
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" );