http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96717
Revision: 96717
Author: dantman
Date: 2011-09-10 07:15:51 +0000 (Sat, 10 Sep 2011)
Log Message:
-----------
Add some other ServicesJson tests.
Modified Paths:
--------------
trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php
Modified: trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php
2011-09-10 06:50:30 UTC (rev 96716)
+++ trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php
2011-09-10 07:15:51 UTC (rev 96717)
@@ -54,18 +54,40 @@
$obj->property3 = 1.234;
return array(
array( 1, 'basic integer' ),
+ array( -1, 'negative integer' ),
+ array( 1.1, 'basic float' ),
array( true, 'basic bool true' ),
array( false, 'basic bool false' ),
array( 'some string', 'basic string test' ),
+ array( "some string\nwith newline", 'newline string
test' ),
+ array( '♥ü', 'unicode string test' ),
array( array( 'some', 'string', 'values' ), 'basic
array of strings' ),
array( array( 'key1' => 'val1', 'key2' => 'val2' ),
'array with string keys' ),
+ array( array( 1 => 'val1', 3 => 'val2', '2' => 'val3'
), 'out of order numbered array test' ),
+ array( array(), 'empty array test' ),
array( $obj, 'basic object test' ),
+ array( new stdClass, 'empty object test' ),
+ array( null, 'null test' ),
);
}
function provideValuesToDecode() {
return array(
+ array( '1', 'basic integer' ),
+ array( '-1', 'negative integer' ),
+ array( '1.1', 'basic float' ),
+ array( '1.1e1', 'scientific float' ),
+ array( 'true', 'basic bool true' ),
+ array( 'false', 'basic bool false' ),
+ array( '"some string"', 'basic string test' ),
+ array( '"some string\nwith newline"', 'newline string
test' ),
+ array( '"♥ü"', 'unicode character string test' ),
+ array( '"\u2665"', 'unicode \\u string test' ),
+ array( '["some","string","values"]', 'basic array of
strings' ),
+ array( '[]', 'empty array test' ),
array( '{"key":"value"}', 'Basic key => value test' ),
+ array( '{}', 'empty object test' ),
+ array( 'null', 'null test' ),
);
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs