For example, cron.php returns a response of zero bytes and this test http://drupal.org/node/261836 fails due to this:

  protected function curlExec($curl_options) {
    ... 
    $this->assertTrue($this->_content, t('!method to !url, response is !length bytes.', array('!method' => empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST', '!url' => $url, '!length' => strlen($this->_content))), t('Browser'));
    return $this->_content;
  }

The assertTrue fails with a content of length 0. Should be like this:

  protected function curlExec($curl_options) {
    ...
    $this->assertTrue($this->_content !== FALSE, t('!method to !url, response is !length bytes.', array('!method' => empty($curl_options[CURLOPT_POSTFIELDS]) ? 'GET' : 'POST', '!url' => $url, '!length' => strlen($this->_content))), t('Browser'));
    return $this->_content;
  }

If the CURLOPT_RETURNTRANSFER option is set, then curl_exec will return the result on success, FALSE on failure.

The patch fixes this.

CommentFileSizeAuthor
drupal-web-test-case-curlexec.patch1.05 KBdropcube
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dropcube’s picture

Status: Needs work » Needs review
boombatower’s picture

Status: Needs review » Reviewed & tested by the community

I think I ran into this when writing different test, but forgot to fix it.

Looks fine.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.