/**
  * Delete groups
  *
  * @param array $groupids array of group ids
  * @since Moodle 2.0
  * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
  * @see core_group_external::delete_groups()
  */
 public static function delete_groups($groupids)
 {
     return core_group_external::delete_groups($groupids);
 }
 /**
  * Test delete_groups
  */
 public function test_delete_groups()
 {
     global $DB;
     $this->resetAfterTest(true);
     $course = self::getDataGenerator()->create_course();
     $group1data = array();
     $group1data['courseid'] = $course->id;
     $group1data['name'] = 'Group Test 1';
     $group1data['description'] = 'Group Test 1 description';
     $group1data['descriptionformat'] = FORMAT_MOODLE;
     $group1data['enrolmentkey'] = 'Test group enrol secret phrase';
     $group2data = array();
     $group2data['courseid'] = $course->id;
     $group2data['name'] = 'Group Test 2';
     $group2data['description'] = 'Group Test 2 description';
     $group3data['courseid'] = $course->id;
     $group3data['name'] = 'Group Test 3';
     $group3data['description'] = 'Group Test 3 description';
     $group1 = self::getDataGenerator()->create_group($group1data);
     $group2 = self::getDataGenerator()->create_group($group2data);
     $group3 = self::getDataGenerator()->create_group($group3data);
     // Set the required capabilities by the external function
     $context = context_course::instance($course->id);
     $roleid = $this->assignUserCapability('moodle/course:managegroups', $context->id);
     $this->assignUserCapability('moodle/course:view', $context->id, $roleid);
     // Checks against DB values
     $groupstotal = $DB->count_records('groups', array());
     $this->assertEquals(3, $groupstotal);
     // Call the external function.
     core_group_external::delete_groups(array($group1->id, $group2->id));
     // Checks against DB values
     $groupstotal = $DB->count_records('groups', array());
     $this->assertEquals(1, $groupstotal);
     // Call without required capability
     $this->unassignUserCapability('moodle/course:managegroups', $context->id, $roleid);
     $this->setExpectedException('required_capability_exception');
     $froups = core_group_external::delete_groups(array($group3->id));
 }