Projet

Général

Profil

Révision b858700c

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/masquerade/masquerade.test
24 24
    $admin_perms = array(
25 25
      'administer site configuration',
26 26
      'administer permissions',
27
      'administer blocks',
28
      'administer masquerade',
29
      'administer users',
30
      'access user profiles',
27 31
      'masquerade as user',
32
      'masquerade as any user',
28 33
    );
29 34
    $admin = $this->drupalCreateUser($admin_perms);
30 35
    $user = $this->drupalCreateUser();
31 36

  
32 37
    $this->drupalLogin($admin);
33 38

  
34
    //test admin form
35
    $this->drupalGet('admin/config/development/masquerade');
39
    // Test accessing the admin form
40
    $this->drupalGet('admin/config/people/masquerade');
41
    $this->assertText(t('Roles that are considered "administrators" for masquerading'));
36 42

  
37
    //test switch
38
    $this->drupalGet('masquerade/switch/' . $user->uid);
39
    $this->assertText('Now masquerading as ' . $user->name);
43
    // Test enabling the Masquerade block
44
    $this->drupalGet('admin/structure/block/manage/masquerade/masquerade/configure');
45
    $this->assertText(t("'@module' block", array('@module' => 'Masquerade')));
46
    $edit = array(
47
      'regions[bartik]' => 'content',
48
      'regions[seven]' => 'content',
49
    );
50
    $this->drupalPost('admin/structure/block/manage/masquerade/masquerade/configure', $edit, t('Save block'));
51
    $this->assertText(t('The block configuration has been saved.'));
52

  
53
    // Test switch from user profile
54
    $this->drupalGet("user/{$user->uid}");
55
    $this->clickLink(t('Masquerade as @name', array('@name' => $user->name)));
56
    $this->assertText(t('You are now masquerading as @name.', array('@name' => $user->name)));
40 57

  
41
    //test unswitch
42
    $this->drupalGet('masquerade/unswitch');
43
    $this->assertText('No longer masquerading as ' . $user->name);
58
    // Test unswitch
59
    $this->drupalGet('');
60
    $this->clickLink(t('Switch back'));
61
    $this->assertText(t('You are no longer masquerading as @name and are now logged in as @admin.',
62
                        array('@name' => $user->name, '@admin' => $admin->name)));
63

  
64
    // Test switch from masquerade block
65
    $edit = array(
66
      'masquerade_user_field' => $user->name,
67
    );
68
    $this->drupalPost('', $edit, t('Go'));
69
    $this->assertText(t('You are now masquerading as @name.', array('@name' => $user->name)));
44 70
  }
45 71

  
46 72
}

Formats disponibles : Unified diff