You are here

protected function WebTestBase::serializePostValues in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::serializePostValues()

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 core/modules/simpletest/src/WebTestBase.php
Perform a POST HTTP request.
WebTestBase::drupalPostAjaxForm in core/modules/simpletest/src/WebTestBase.php
Executes an Ajax form submission.
WebTestBase::drupalPostForm in core/modules/simpletest/src/WebTestBase.php
Executes a form submission.

File

core/modules/simpletest/src/WebTestBase.php, line 2171
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

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