You are here

public function QueryParametersToURLUnitTestCase::testQueryParameterValuesEncoding in Query Parameters To URL 7

Tests if a query parameter's values are properly encoded.

File

./query_parameters_to_url.test, line 369
Query Arguments To URL tests.

Class

QueryParametersToURLUnitTestCase
Class QueryParametersToURLUnitTestCase.

Code

public function testQueryParameterValuesEncoding() {
  $test_cases = $this
    ->getTestCases();
  foreach ($test_cases as $test_case) {
    list($parameter_values, $expected_query_parameter_string) = $this
      ->unpackTestCase($test_case);
    $encoded_query_parameter = query_parameters_to_url_encode_query_parameter_values($parameter_values);
    $message = 'Query parameter values are encoded properly.<br/> Initial array:<br/>!initial<br/>Encoded to string:<br/>!string';
    $message = format_string($message, array(
      '!initial' => var_export($parameter_values, TRUE),
      '!string' => var_export($encoded_query_parameter, TRUE),
    ));
    $this
      ->assertEqual($encoded_query_parameter, $expected_query_parameter_string, $message);
  }
}