Revision 27e02aed
Added by Assos Assos over 4 years ago
drupal7/modules/simpletest/tests/common.test | ||
---|---|---|
1124 | 1124 |
$this->assertEqual($unable_to_parse->code, -1001, 'Returned with "-1001" error code.'); |
1125 | 1125 |
$this->assertEqual($unable_to_parse->error, 'unable to parse URL', 'Returned with "unable to parse URL" error message.'); |
1126 | 1126 |
|
1127 |
// Fetch page. |
|
1128 |
$result = drupal_http_request(url('node', array('absolute' => TRUE))); |
|
1127 |
// Fetch page and check that the data parameter works with both array and string. |
|
1128 |
$data_array = array($this->randomName() => $this->randomString() . ' "\''); |
|
1129 |
$data_string = drupal_http_build_query($data_array); |
|
1130 |
$result = drupal_http_request(url('node', array('absolute' => TRUE)), array('data' => $data_array)); |
|
1129 | 1131 |
$this->assertEqual($result->code, 200, 'Fetched page successfully.'); |
1132 |
$this->assertTrue(substr($result->request, -strlen($data_string)) === $data_string, 'Request ends with URL-encoded data when drupal_http_request() called using array.'); |
|
1133 |
$result = drupal_http_request(url('node', array('absolute' => TRUE)), array('data' => $data_string)); |
|
1134 |
$this->assertTrue(substr($result->request, -strlen($data_string)) === $data_string, 'Request ends with URL-encoded data when drupal_http_request() called using string.'); |
|
1135 |
|
|
1130 | 1136 |
$this->drupalSetContent($result->data); |
1131 | 1137 |
$this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.'); |
1132 | 1138 |
|
Also available in: Unified diff
-a