diff options
author | Legoktm <legoktm@member.fsf.org> | 2019-06-13 23:00:08 +0000 |
---|---|---|
committer | Legoktm <legoktm@member.fsf.org> | 2019-06-13 23:00:08 +0000 |
commit | 4e35134f7a3228a8195a07f49c85188e57ab8487 (patch) | |
tree | d9750a18496af4c52eb5dfce56f0d0b79fbd32cb /tests/phpunit/includes/libs/StaticArrayWriterTest.php | |
parent | 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9 (diff) | |
download | mediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.tar.gz mediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.zip |
Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9.
Reason for revert: Broke postgres tests.
Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
Diffstat (limited to 'tests/phpunit/includes/libs/StaticArrayWriterTest.php')
-rw-r--r-- | tests/phpunit/includes/libs/StaticArrayWriterTest.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/phpunit/includes/libs/StaticArrayWriterTest.php b/tests/phpunit/includes/libs/StaticArrayWriterTest.php new file mode 100644 index 000000000000..4bd845d0b992 --- /dev/null +++ b/tests/phpunit/includes/libs/StaticArrayWriterTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright (C) 2018 Kunal Mehta <legoktm@member.fsf.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +use Wikimedia\StaticArrayWriter; + +/** + * @covers \Wikimedia\StaticArrayWriter + */ +class StaticArrayWriterTest extends PHPUnit\Framework\TestCase { + public function testCreate() { + $data = [ + 'foo' => 'bar', + 'baz' => 'rawr', + "they're" => '"quoted properly"', + 'nested' => [ 'elements', 'work' ], + 'and' => [ 'these' => 'do too' ], + ]; + $writer = new StaticArrayWriter(); + $actual = $writer->create( $data, "Header\nWith\nNewlines" ); + $expected = <<<PHP +<?php +// Header +// With +// Newlines +return [ + 'foo' => 'bar', + 'baz' => 'rawr', + 'they\'re' => '"quoted properly"', + 'nested' => [ + 0 => 'elements', + 1 => 'work', + ], + 'and' => [ + 'these' => 'do too', + ], +]; + +PHP; + $this->assertSame( $expected, $actual ); + } +} |