diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php index a4641f6..3d609ff 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php @@ -111,25 +111,19 @@ function testUserAgentValidation() { $this->additionalCurlOptions = array(CURLOPT_USERAGENT => $test_ua); // Test pages only available for testing. - $this->drupalGet($HTTP_path); - $this->assertResponse(200, 'Requesting http.php with a legitimate simpletest User-Agent returns OK.'); - $this->drupalGet($https_path); - $this->assertResponse(200, 'Requesting https.php with a legitimate simpletest User-Agent returns OK.'); + $this->drupalGet($HTTP_path, array(), array(), 200, 'Requesting http.php with a legitimate simpletest User-Agent returns OK.'); + $this->drupalGet($https_path, array(), array(), 200, 'Requesting https.php with a legitimate simpletest User-Agent returns OK.'); // Now slightly modify the HMAC on the header, which should not validate. $this->additionalCurlOptions = array(CURLOPT_USERAGENT => $test_ua . 'X'); - $this->drupalGet($HTTP_path); - $this->assertResponse(403, 'Requesting http.php with a bad simpletest User-Agent fails.'); - $this->drupalGet($https_path); - $this->assertResponse(403, 'Requesting https.php with a bad simpletest User-Agent fails.'); + $this->drupalGet($HTTP_path, array(), array(), 403, 'Requesting http.php with a bad simpletest User-Agent fails.'); + $this->drupalGet($https_path, array(), array(), 403, 'Requesting https.php with a bad simpletest User-Agent fails.'); // Use a real User-Agent and verify that the special files http.php and // https.php can't be accessed. $this->additionalCurlOptions = array(CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'); - $this->drupalGet($HTTP_path); - $this->assertResponse(403, 'Requesting http.php with a normal User-Agent fails.'); - $this->drupalGet($https_path); - $this->assertResponse(403, 'Requesting https.php with a normal User-Agent fails.'); + $this->drupalGet($HTTP_path, array(), array(), 403, 'Requesting http.php with a normal User-Agent fails.'); + $this->drupalGet($https_path, array(), array(), 403, 'Requesting https.php with a normal User-Agent fails.'); } } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index a75ade4..d36db7f 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -1168,17 +1168,21 @@ protected function parse() { /** * Retrieves a Drupal path or an absolute path. * - * @param $path + * @param string $path * Drupal path or URL to load into internal browser - * @param $options + * @param array $options * Options to be forwarded to url(). - * @param $headers + * @param array $headers * An array containing additional HTTP request headers, each formatted as * "name: value". - * @return + * @param int|null $code + * The expected response code, defaults to NULL> + * @param string $message + * Sets the message of the response assertion if code is specified. + * @return string * The retrieved HTML string, also available as $this->drupalGetContent() */ - protected function drupalGet($path, array $options = array(), array $headers = array()) { + protected function drupalGet($path, array $options = array(), array $headers = array(), $code = NULL, $message = '') { $options['absolute'] = TRUE; // We re-using a CURL connection here. If that connection still has certain @@ -1194,6 +1198,11 @@ protected function drupalGet($path, array $options = array(), array $headers = a $this->verbose('GET request to: ' . $path . '