1 path_pattern.test PathPatternFunctionalTestCase::testUserOperations()

Test user operations.

File

core/modules/path/tests/path_pattern.test, line 684
Functionality tests for automatic path generation.

Class

PathPatternFunctionalTestCase
Test basic Path automatic URL alias functionality.

Code

function testUserOperations() {
  $account = $this->backdropCreateUser();

  // Delete all current URL aliases.
  $this->deleteAllAliases();

  // Find the last row in the users table to apply the URL alias to the new user.
  $this->backdropGet('admin/people', array('query' => array('order' => 'created', 'sort' => 'asc')));
  $checkbox = $this->xpath('//form[@id="views-form-user-admin-page"]//tr[last()]//input[@type="checkbox"]');
  $checkbox_name = (string) $checkbox[0]['name'];

  $edit = array(
    'action' => 'path_user_update_action',
    $checkbox_name => TRUE,
  );
  $this->backdropPost('admin/people', $edit, t('Execute'), array('query' => array('order' => 'created', 'sort' => 'asc')));
  $this->assertRaw(format_string('%action was applied to 1 item.', array('%action' => 'Update user URL alias')));

  $this->assertEntityAlias('user', $account, 'accounts/' . backdrop_strtolower($account->name));
  $this->assertEntityAlias('user', $this->admin_user, 'user/' . $this->admin_user->uid);
}