You are here

public function ServicesAliasTests::testAlias in Services 7.3

Testing parser functionality.

File

tests/functional/ServicesAliasTests.test, line 101
Test to confirm Aliases functionality.

Class

ServicesAliasTests
Test case class for Alias tests.

Code

public function testAlias() {
  $account = $this
    ->drupalCreateUser();

  // Logout first.
  $this
    ->drupalLogout();

  // Try to login using alias.
  $response = $this
    ->servicesPost($this->endpoint->path . '/user-alias/login', array(
    'name' => $account->name,
    'pass' => $account->pass_raw,
  ));
  $response_data = $response['body'];
  $proper_answer = isset($response_data->sessid) && isset($response_data->user) && $response_data->user->name == $account->name;
  $this
    ->assertTrue($proper_answer, 'User successfully logged in.', 'Alias: User login');
}