function CommonURLUnitTest::testDrupalHttpBuildQuery in SimpleTest 7
Test drupal_http_build_query().
File
- tests/
common.test, line 129 - Tests for common.inc functionality.
Class
- CommonURLUnitTest
- Tests for URL generation functions.
Code
function testDrupalHttpBuildQuery() {
$this
->assertEqual(drupal_http_build_query(array(
'a' => ' &#//+%20@۞',
)), 'a=%20%26%23//%2B%2520%40%DB%9E', t('Value was properly encoded.'));
$this
->assertEqual(drupal_http_build_query(array(
' &#//+%20@۞' => 'a',
)), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', t('Key was properly encoded.'));
$this
->assertEqual(drupal_http_build_query(array(
'a' => '1',
'b' => '2',
'c' => '3',
)), 'a=1&b=2&c=3', t('Multiple values were properly concatenated.'));
$this
->assertEqual(drupal_http_build_query(array(
'a' => array(
'b' => '2',
'c' => '3',
),
'd' => 'foo',
)), 'a[b]=2&a[c]=3&d=foo', t('Nested array was properly encoded.'));
}