You are here

public function AuthcacheUserTest::testUserSettingsCallback in Authenticated User Page Caching (Authcache) 7.2

User settings callback should return uid, name and mail of logged-in user.

File

modules/authcache_user/authcache_user.test, line 141
Test cases for the Authcache User module.

Class

AuthcacheUserTest
Tests for markup substitution.

Code

public function testUserSettingsCallback() {
  $this
    ->drupalLogin($this->member1);
  $url = authcache_p13n_request_get_callback('setting/user', NULL);
  $this
    ->assertTrue($url);

  // First request should report seeded timestamp.
  $result = $this
    ->drupalGetAjax($GLOBALS['base_root'] . $url['path'], $url['options'], array(
    'X-Authcache: 1',
  ));
  $this
    ->assertResponse(200);
  $expect = array(
    'authcacheUser' => array(
      'uid' => $this->member1->uid,
      'name' => $this->member1->name,
      'mail' => $this->member1->mail,
    ),
  );
  $this
    ->assertEqual($expect, $result);
}