/** * Tests creating a new shortcut set with a defined set name. */ function testGradeScaleCreateWithSetName() { $random_name = $this->randomMachineName(); $new_set = $this->generateGradeScale($random_name, $random_name); $sets = GradeScale::loadMultiple(); $this->assertTrue(isset($sets[$random_name]), 'Successfully created a shortcut set with a defined set name.'); $this->drupalGet('user/' . $this->adminUser->id() . '/shortcuts'); $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.'); }
/** * Creates a generic shortcut set. */ function generateGradeScale($label = '', $id = NULL) { $set = GradeScale::create(array('id' => isset($id) ? $id : strtolower($this->randomMachineName()), 'label' => empty($label) ? $this->randomString() : $label)); $set->save(); return $set; }