I can't make my tests login users. This is the code i'm trying right now

<?php
class FooTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'test',
      'description' => 'test',
      'group' => 'Foo',
    );
  }

  public function setUp() {
    parent::setUp();
  }

  public function testLogin() {
    $user = $this->drupalCreateUser(array('access content'));
    $this->drupalLogin($user);
  }
}
?>

Test does begin, i get the batch screen with the progress bar. After
a while the progress bar stops blinking and the page goes out of control.

Ive tried this http://drupal.org/node/295559, but didnt fix the issue for me.

Comments

brazorf’s picture

Digging into simpletest code, i found that this is related to drupalGet().
Any $this->drupalGet('anything') produces a javascript error (i saw in Firebug), and i think
this must be related to the CURL result: although CURLOPT_RETURNTRANSFER is set to 1
in curlInitialize(), my curl response (i logged into a file) is exactly 1, so no html
is fetched.

I've read this one http://drupal.org/node/1671200, that is related to
CURLOPT_COOKIEJAR being empty, and tried the suggested patch, with no luck.

brazorf’s picture

This turned out to be a curl_setopt_array issue in the DrupalWebTestCase::curlInitialize().

I applied the above mentioned patch and curl_setopt_array is returning FALSE.

brazorf’s picture

Status: Active » Closed (duplicate)

Ok, i solved this and i opened another, more specific, issue here: http://drupal.org/node/1993480

Briefly, problem was in the CURLOPT_FOLLOWLOCATION curl option, and you can solve that changin safe_mode = Off and
unsetting open_basedir in your php configuration. If you are running php >= 5.4 you may not solve this issue, since CURLOPT_FOLLOWLOCATION has been removed.