I've been trying to write my first tests and I ran into a couple of issues that slowed me down a bit...

According to what I found in the issue queue, cURL is required in order to use DrupalWebTestCase. However, that's not mentioned on the SimpleTest project page or in the documentation anywhere that I could find.

Another thing I found confusing is that the DrupalWebTestCase - API and assertions documentation page mentions that "By extending DrupalWebTestCase your test inherits all features of both WebTestCase. . ." However, the original WebTestCase doesn't appear to be part of the SimpleTest 6.x-2.6 version. Specifically, I was trying to use assertHeader, but that no longer appears to be provided.

Comments

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)

The curl requirement is in the hook_requirements:

$has_curl = function_exists('curl_init');
  $has_domdocument = class_exists('DOMDocument');

  $requirements['curl'] = array(
    'title' => $t('cURL'),
    'value' => $has_curl ? $t('Enabled') : $t('Not found'),
  );
  if (!$has_curl) {
    $requirements['curl']['severity'] = REQUIREMENT_ERROR;
    $requirements['curl']['description'] = $t('Simpletest could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array('@curl_url' => 'http://php.net/manual/en/curl.setup.php'));
  }

The documentation may need updating, but 2.x is a backport of D7 core...and has nothing to do with old DrupalTestCase.

For more information read the getting started page linked to on the project page

matt v.’s picture

Regarding cURL, the main point I was trying to make was that it might be helpful to mention cURL as a requirement on the project page and/or the documentation.

Regarding the DrupalWebTestCase - API and assertions documentation page, the part I found confusing was the following sentence...

By extending DrupalWebTestCase your test inherits all features of both WebTestCase and UnitTestCase, as well as the Drupal-specific features of DrupalWebTestCase.

Since assertHeader is a part of WebTestCase, I thought it would be available. So, does that sentence only apply to the D6 1.x version and prior?

By the way, thanks for all the great work on the module and testing in general. Your tests for Profile role and Profile permission helped to give me a better understanding of what I needed to do.

boombatower’s picture

Assigned: Unassigned » boombatower

In SimpleTest 1.x it extends the DrupalTestCase and simpletest.org framework which has those methods. So it sounds like the documentation needs to be updated.

I'll add something about curl tomorrow.

boombatower’s picture

Title: cURL required for DrupalWebTestCase & WebTestCase confusion » Add curl requirement to documentation
boombatower’s picture

Status: Postponed (maintainer needs more info) » Fixed

Added to http://drupal.org/project/simpletest
and INSTALL.txt

Status: Fixed » Closed (fixed)

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