diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
commit | 9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch) | |
tree | 46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/tests/XmlTest.php | |
parent | 78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff) |
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/tests/XmlTest.php')
-rw-r--r-- | maintenance/tests/XmlTest.php | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/maintenance/tests/XmlTest.php b/maintenance/tests/XmlTest.php deleted file mode 100644 index 330e60c6..00000000 --- a/maintenance/tests/XmlTest.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -class XmlTest extends PHPUnit_Framework_TestCase { - - function testElementOpen() { - $this->assertEquals( - '<element>', - Xml::element( 'element', null, null ), - 'Opening element with no attributes' - ); - } - - function testElementEmpty() { - $this->assertEquals( - '<element />', - Xml::element( 'element', null, '' ), - 'Terminated empty element' - ); - } - - function testElementEscaping() { - $this->assertEquals( - '<element>hello <there> you & you</element>', - Xml::element( 'element', null, 'hello <there> you & you' ), - 'Element with no attributes and content that needs escaping' - ); - } - - function testElementAttributes() { - $this->assertEquals( - '<element key="value" <>="<>">', - Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ), - 'Element attributes, keys are not escaped' - ); - } - - function testOpenElement() { - $this->assertEquals( - '<element k="v">', - Xml::openElement( 'element', array( 'k' => 'v' ) ), - 'openElement() shortcut' - ); - } - - function testCloseElement() { - $this->assertEquals( '</element>', Xml::closeElement( 'element' ), 'closeElement() shortcut' ); - } - - # - # textarea - # - function testTextareaNoContent() { - $this->assertEquals( - '<textarea name="name" id="name" cols="40" rows="5"></textarea>', - Xml::textarea( 'name', '' ), - 'textarea() with not content' - ); - } - - function testTextareaAttribs() { - $this->assertEquals( - '<textarea name="name" id="name" cols="20" rows="10"><txt></textarea>', - Xml::textarea( 'name', '<txt>', 20, 10 ), - 'textarea() with custom attribs' - ); - } - - # - # JS - # - function testEscapeJsStringSpecialChars() { - $this->assertEquals( - '\\\\\r\n', - Xml::escapeJsString( "\\\r\n" ), - 'escapeJsString() with special characters' - ); - } - - function testEncodeJsVarBoolean() { - $this->assertEquals( - 'true', - Xml::encodeJsVar( true ), - 'encodeJsVar() with boolean' - ); - } - - function testEncodeJsVarNull() { - $this->assertEquals( - 'null', - Xml::encodeJsVar( null ), - 'encodeJsVar() with null' - ); - } - - function testEncodeJsVarArray() { - $this->assertEquals( - '["a", 1]', - Xml::encodeJsVar( array( 'a', 1 ) ), - 'encodeJsVar() with array' - ); - $this->assertEquals( - '{"a": "a", "b": 1}', - Xml::encodeJsVar( array( 'a' => 'a', 'b' => 1 ) ), - 'encodeJsVar() with associative array' - ); - } - - function testEncodeJsVarObject() { - $this->assertEquals( - '{"a": "a", "b": 1}', - Xml::encodeJsVar( (object)array( 'a' => 'a', 'b' => 1 ) ), - 'encodeJsVar() with object' - ); - } -} |