Ejemplo n.º 1
0
 function test_cleanUp()
 {
     $registry = Registry::getInstance();
     $setup = $registry->get(self::REG_KEY);
     Stage::delete($setup['stageId']);
     Lesson::delete($setup['lessonId']);
     Course::delete($setup['courseId']);
     Admin::delete($setup['ownerId']);
     $db = $registry->get(Stage::DB);
     $db->query("DELETE FROM `" . StageL10n::TABLE . "` WHERE `description` LIKE 'unitTest%'");
     $db->query("DELETE FROM `" . Stage::TABLE . "` WHERE `name` LIKE 'unitTest%'");
     $registry->set(self::REG_KEY, null);
 }
Ejemplo n.º 2
0
 function renumber()
 {
     Course::renumberAll($_POST['order']);
     echo 'OK';
 }
Ejemplo n.º 3
0
 function test_cleanUp()
 {
     $registry = Registry::getInstance();
     $setup = $registry->get(self::REG_KEY);
     Material::delete($setup['id']);
     Stage::delete($setup['stageId']);
     Lesson::delete($setup['lessonId']);
     Course::delete($setup['courseId']);
     Admin::delete($setup['ownerId']);
     $db = $registry->get(Material::DB);
     $db->query("DELETE FROM `" . MaterialL10n::TABLE . "` WHERE `parent_id`={$setup['id']}") or die($db->lastError);
     #        $db->query("DELETE FROM `".MaterialL10n::TABLE."` WHERE `original_file_name`='gcode.gif'") or die($db->lastError);
     $db->query("DELETE FROM `" . Material::TABLE . "` WHERE `name` LIKE 'unitTest%'") or die($db->lastError);
     $db->query("DELETE FROM `" . Stage::TABLE . "` WHERE `name` LIKE 'unitTest%'") or die($db->lastError);
     $db->query("DELETE FROM `" . Exercise::TABLE . "` WHERE `name` LIKE 'unitTest%'") or die($db->lastError);
     $db->query("DELETE FROM `" . Lesson::TABLE . "` WHERE EXISTS(SELECT * FROM `" . LessonL10n::TABLE . "` `s` WHERE `parent_id`=`" . Lesson::TABLE . "`.`id` AND `s`.`name` LIKE 'unitTest%')") or die($db->lastError);
     $registry->set(self::REG_KEY, null);
 }
Ejemplo n.º 4
0
 static function createCourse($ownerId)
 {
     $course = new Course();
     $course->ownerId = $ownerId;
     $course->state = 8;
     $course->l10n = self::createLocale();
     $course->save();
     return $course;
 }