You are here

function AutoassignroleAdminRolePerPageTestCase::testAutoRolePerPageAdd in Auto Assign Role 7

Same name and namespace in other branches
  1. 7.2 autoassignrole.test \AutoassignroleAdminRolePerPageTestCase::testAutoRolePerPageAdd()

Test admin functionality of creating a role per path.

See also

https://www.drupal.org/node/971320

File

./autoassignrole.test, line 699
Creates tests for auto assign role module.

Class

AutoassignroleAdminRolePerPageTestCase
Extend the DrupalWebTestCase.

Code

function testAutoRolePerPageAdd() {

  // Create a new user who can access the administration settings.
  $this
    ->drupalLogin($this->admin_user);

  // Check that the user can see the admin add page.
  $this
    ->createAarPage();

  // Click to edit this new path.
  $this
    ->clickLink(t('Edit'));

  // Verify the title has been saved correctly.
  $this
    ->assertFieldByName('title', $this->page_title, 'Role per path title has random string');
  $this
    ->assertFieldByName('path', 'test/register/' . $this->page_title, 'Role per path path is correct');

  // Go back to the list of AAR pages.
  $this
    ->drupalGet('admin/config/people/autoassignrole/pages');

  // Click to delete link.
  $this
    ->clickLink(t('Delete'));

  // Verify the delete confirmation message.
  $this
    ->assertText('Are you sure you want to delete the page ' . $this->page_title);
}