You are here

protected function WebTestBase::serializePostValues in SimpleTest 8.3

Serialize POST HTTP request values.

Encode according to application/x-www-form-urlencoded. Both names and values needs to be urlencoded, according to http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1

Parameters

array $post: The array of values to be POSTed.

Return value

string The serialized result.

3 calls to WebTestBase::serializePostValues()
WebTestBase::drupalPost in src/WebTestBase.php
Perform a POST HTTP request.
WebTestBase::drupalPostAjaxForm in src/WebTestBase.php
Executes an Ajax form submission.
WebTestBase::drupalPostForm in src/WebTestBase.php
Executes a form submission.

File

src/WebTestBase.php, line 1434

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function serializePostValues($post = []) {
  foreach ($post as $key => $value) {
    $post[$key] = urlencode($key) . '=' . urlencode($value);
  }
  return implode('&', $post);
}