t('Admin menu functionality'), 'desc' => t('Enable a module, make sure and admin user can see the new link.'), 'group' => t('Admin menu tests'), ); } function setUp() { parent::setUp(); $this->drupalModuleEnable('admin_menu'); $this->drupalModuleDisable('contact'); $this->drupalModuleDisable('devel'); } /** * Test that the links are added to the page (no JS testing) */ function testAdminMenu() { // create user $admin_user = $this->drupalCreateUserRolePerm(array('administer site configuration', 'access administration pages', 'administer nodes', 'access administration menu', 'administer site-wide contact form')); $this->assertNoUnwantedRaw('
', 'Admin menu not displayed to anonymous.'); $this->drupalLoginUser($admin_user); $this->assertWantedRaw('
', 'Admin menu displayed to admin user.'); $this->drupalGet('node'); $this->assertFalse(preg_match('@
(.*\n)*.*http://drupal.org@', $this->drupalGetContent()), 'Drupal link not found'); $this->assertFalse(preg_match('@
(.*\n)*.*admin/build/contact@', $this->drupalGetContent()), 'Contact module link not found'); $this->drupalModuleEnable('contact'); // Go to modules page for menu rebuild $this->drupalGet('admin/build/modules'); $this->drupalGet('node'); $this->assertTrue(preg_match('@
(.*\n)*.*admin/build/contact@', $this->drupalGetContent()), 'Contact module link found'); $this->drupalGet('logout'); $admin_user2 = $this->drupalCreateUserRolePerm(array('administer site configuration', 'access administration pages', 'administer nodes', 'access administration menu', 'display drupal links')); $this->drupalLoginUser($admin_user2); $this->drupalGet('node'); $this->assertTrue(preg_match('@
(.*\n)*.*http://drupal.org@', $this->drupalGetContent()), 'Drupal link found'); $this->assertFalse(preg_match('@
(.*\n)*.*admin/build/contact@', $this->drupalGetContent()), 'Contact module link not found'); } }