Ejemplo n.º 1
0
 function setUp()
 {
     parent::setUp();
     if ($this->profile != 'standard') {
         // Create Basic page and Article node types.
         $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
         $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
         // Populate the default shortcut set.
         $shortcut = Shortcut::create(array('set' => 'default', 'title' => t('Add content'), 'weight' => -20, 'path' => 'node/add'));
         $shortcut->save();
         $shortcut = Shortcut::create(array('set' => 'default', 'title' => t('All content'), 'weight' => -19, 'path' => 'admin/content'));
         $shortcut->save();
     }
     // Create users.
     $this->admin_user = $this->drupalCreateUser(array('access toolbar', 'administer shortcuts', 'view the administration theme', 'create article content', 'create page content', 'access content overview', 'administer users'));
     $this->shortcut_user = $this->drupalCreateUser(array('customize shortcut links', 'switch shortcut sets'));
     // Create a node.
     $this->node = $this->drupalCreateNode(array('type' => 'article'));
     // Log in as admin and grab the default shortcut set.
     $this->drupalLogin($this->admin_user);
     $this->set = ShortcutSet::load('default');
     shortcut_set_assign_user($this->set, $this->admin_user);
 }
 /**
  * Tests unassigning a shortcut set.
  */
 function testShortcutSetUnassign()
 {
     $new_set = $this->generateShortcutSet($this->randomMachineName());
     shortcut_set_assign_user($new_set, $this->shortcut_user);
     shortcut_set_unassign_user($this->shortcut_user);
     $current_set = shortcut_current_displayed_set($this->shortcut_user);
     $default_set = shortcut_default_set($this->shortcut_user);
     $this->assertTrue($current_set->id() == $default_set->id(), "Successfully unassigned another user's shortcut set.");
 }