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 grade letter set.
         $shortcut = GradeLetter::create(array('grade_letter_set' => 'default', 'title' => t('Add content'), 'weight' => -20, 'link' => array('uri' => 'internal:/node/add')));
         $shortcut->save();
         $shortcut = GradeLetter::create(array('grade_letter_set' => '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 grade letter set.
     $this->drupalLogin($this->adminUser);
     $this->set = GradeLetterSet::load('default');
     \Drupal::entityManager()->getStorage('grade_letter_set')->assignUser($this->set, $this->adminUser);
 }
Exemple #2
0
 /**
  * Tests renaming a grade letter set.
  */
 function testGradeLetterSetRename()
 {
     $set = $this->set;
     $new_label = $this->randomMachineName();
     $this->drupalGet('admin/config/user-interface/shortcut');
     $this->clickLink(t('Edit grade letter set'));
     $this->drupalPostForm(NULL, array('label' => $new_label), t('Save'));
     $set = GradeLetterSet::load($set->id());
     $this->assertTrue($set->label() == $new_label, 'GradeLetter set has been successfully renamed.');
 }