You are here

public function BlogapiBloggerEndpointTestCase::testGetUserInfo in Blog API 7.2

Test blogger.getUserInfo().

File

modules/blogapi_blogger/blogapi_blogger.test, line 79
Endpoint tests for BlogAPI Blogger

Class

BlogapiBloggerEndpointTestCase
@file Endpoint tests for BlogAPI Blogger

Code

public function testGetUserInfo() {
  $user_info = xmlrpc($this->xmlrpcUrl, array(
    'blogger.getUserInfo' => array(
      '1234567890',
      $this->privilegedUser->name,
      $this->privilegedUser->pass_raw,
    ),
  ));

  // Get firstname and lastname
  $name = explode(' ', !empty($this->privilegedUser->realname) ? $this->privilegedUser->realname : $this->privilegedUser->name, 2);

  // Check other retrieved pieces of data
  $this
    ->assertEqual($user_info['userid'], $this->privilegedUser->uid, 'Returned data has correct userid');
  $this
    ->assertEqual($user_info['firstname'], $name[0], 'Returned data has correct username');
  $this
    ->assertEqual($user_info['lastname'], !empty($name[1]) ? $name[1] : '', 'Returned data has correct lastname');
  $this
    ->assertEqual($user_info['nickname'], $this->privilegedUser->name, 'Returned data has correct nickname');
  $this
    ->assertEqual($user_info['email'], $this->privilegedUser->mail, 'Returned data has correct email.');
  $this
    ->assertEqual($user_info['url'], url('user/' . $this->privilegedUser->uid, array(
    'absolute' => TRUE,
  )), 'Returned data has correct URL');
}