protected 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('grade_scale' => 'default', 'title' => t('Add content'), 'weight' => -20, 'link' => array('uri' => 'internal:/node/add'))); $shortcut->save(); $shortcut = Shortcut::create(array('grade_scale' => 'default', 'title' => t('All content'), 'weight' => -19, 'link' => array('uri' => 'internal:/admin/content'))); $shortcut->save(); } // Create users. $this->adminUser = $this->drupalCreateUser(array('access toolbar', 'administer shortcuts', 'view the administration theme', 'create article content', 'create page content', 'access content overview', 'administer users', 'link to any page', 'edit any article content')); $this->shortcutUser = $this->drupalCreateUser(array('customize shortcut links', 'switch shortcut sets', 'access shortcuts', 'access content')); // Create a node. $this->node = $this->drupalCreateNode(array('type' => 'article')); // Log in as admin and grab the default shortcut set. $this->drupalLogin($this->adminUser); $this->set = GradeScale::load('default'); \Drupal::entityManager()->getStorage('grade_scale')->assignUser($this->set, $this->adminUser); }
/** * Tests renaming a shortcut set. */ function testGradeScaleRename() { $set = $this->set; $new_label = $this->randomMachineName(); $this->drupalGet('admin/config/user-interface/shortcut'); $this->clickLink(t('Edit shortcut set')); $this->drupalPostForm(NULL, array('label' => $new_label), t('Save')); $set = GradeScale::load($set->id()); $this->assertTrue($set->label() == $new_label, 'Shortcut set has been successfully renamed.'); }