Page MenuHomeWickedGov Phorge

PhpFileWriterTest.php
No OneTemporary

Size
981 B
Referenced Files
None
Subscribers
None

PhpFileWriterTest.php

<?php
use MediaWiki\Extension\CLDR\PhpFileWriter;
/**
* @license GPL-2.0-or-later
*
* @covers MediaWiki\Extension\CLDR\PhpFileWriter
*/
class PhpFileWriterTest extends MediaWikiIntegrationTestCase {
/**
* @dataProvider provideSavePhp
* @param array $data
* @param string $expectedText
*/
public function testSavePhp( $data, $expectedText ) {
$tmpFile = tempnam( sys_get_temp_dir(), 'testSavePhp' );
$writer = new PhpFileWriter();
$writer->savephp( $data, $tmpFile );
$this->assertEquals(
$expectedText,
file_get_contents( $tmpFile )
);
}
public static function provideSavePhp() {
return [
'no data' => [ [], '' ],
'basic' => [
[
'testEmpty' => [],
'testStr' => [ 'foo' ],
'testList' => [ 'foo' => 'bar' ],
],
<<<'EOT'
<?php
// This file is generated by rebuild.php. Do not edit it directly.
$testStr = [
'foo',
];
$testList = [
'foo' => 'bar',
];
EOT,
],
];
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 17 2026, 02:27 (11 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a7/6b/923d57c71c8c4c678994db454276
Default Alt Text
PhpFileWriterTest.php (981 B)

Event Timeline