PythonSingleFFSTest.php
Go to the documentation of this file.00001 <?php
00014 class PythonSingleFFSTest extends MediaWikiTestCase {
00015 protected $groupConfiguration;
00016
00017 public function setUp() {
00018 parent::setUp();
00019 $this->groupConfiguration = array(
00020 'BASIC' => array(
00021 'class' => 'FileBasedMessageGroup',
00022 'id' => 'test-id',
00023 'label' => 'Test Label',
00024 'namespace' => 'NS_MEDIAWIKI',
00025 'description' => 'Test description',
00026 ),
00027 'FILES' => array(
00028 'class' => 'PythonSingleFFS',
00029 'sourcePattern' => __DIR__ . '/../data/pythontest.py',
00030 'targetPattern' => __DIR__ . '/../data/pythontest.py',
00031 'codeMap' => array(
00032 'fi' => 'encrypted',
00033 )
00034 ),
00035 );
00036 }
00037
00038 public function testParsing() {
00040 $group = MessageGroupBase::factory( $this->groupConfiguration );
00041 $ffs = new PythonSingleFFS( $group );
00042
00043 $command = wfEscapeShellArg( "import simplejson as json; print 'mui'" );
00044 $ret = wfShellExec( "python -c $command" );
00045 if ( trim( $ret ) !== 'mui' ) {
00046 $this->markTestSkipped( 'Dependency python simplejson not installed' );
00047
00048 return;
00049 }
00050
00051 $parsed = $ffs->read( 'en' );
00052 $expected = array(
00053 'MESSAGES' => array( 'user' => 'Users' )
00054 );
00055 $this->assertEquals( $expected, $parsed );
00056
00057 $parsed = $ffs->read( 'fi' );
00058 $expected = array(
00059 'MESSAGES' => array( 'user' => 'Käyttäjät' )
00060 );
00061 $this->assertEquals( $expected, $parsed );
00062 }
00063 }