1 common.test CommonBackdropHTTPRequestTestCase::testBackdropHTTPRequestBasicAuth()

File

core/modules/simpletest/tests/common.test, line 1100
Tests for common.inc functionality.

Class

CommonBackdropHTTPRequestTestCase
Test backdrop_http_request().

Code

function testBackdropHTTPRequestBasicAuth() {
  $username = $this->randomName();
  $password = $this->randomName();
  $url = url('system-test/auth', array('absolute' => TRUE));

  $auth = str_replace('://', '://' . $username . ':' . $password . '@', $url);
  $result = backdrop_http_request($auth);

  $this->backdropSetContent($result->data);
  $this->assertRaw($username, 'Username is passed correctly.');
  $this->assertRaw($password, 'Password is passed correctly.');
}