MediaWiki REL1_33
StaticArrayWriterTest.php
Go to the documentation of this file.
1<?php
22
26class StaticArrayWriterTest extends PHPUnit\Framework\TestCase {
27 public function testCreate() {
28 $data = [
29 'foo' => 'bar',
30 'baz' => 'rawr',
31 "they're" => '"quoted properly"',
32 'nested' => [ 'elements', 'work' ],
33 'and' => [ 'these' => 'do too' ],
34 ];
35 $writer = new StaticArrayWriter();
36 $actual = $writer->create( $data, "Header\nWith\nNewlines" );
37 $expected = <<<PHP
38<?php
39// Header
40// With
41// Newlines
42return [
43 'foo' => 'bar',
44 'baz' => 'rawr',
45 'they\'re' => '"quoted properly"',
46 'nested' => [
47 0 => 'elements',
48 1 => 'work',
49 ],
50 'and' => [
51 'these' => 'do too',
52 ],
53];
54
55PHP;
56 $this->assertSame( $expected, $actual );
57 }
58}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
\Wikimedia\StaticArrayWriter
Format a static PHP array to be written to a file.
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types as usual *javascript user provided javascript code *json simple implementation for use by etc *css user provided css code *text plain text In PHP
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)