mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-53700 competency: Migrate tasks to core
This commit is contained in:
parent
a4e659c788
commit
42a7899f0d
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tasks definitions.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$tasks = array(
|
||||
array(
|
||||
'classname' => 'tool_lp\task\complete_plans_task',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'tool_lp\task\sync_plans_from_template_cohorts_task',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
);
|
@ -70,8 +70,8 @@ class tool_lp_task_testcase extends advanced_testcase {
|
||||
|
||||
$this->assertEquals(2, $created);
|
||||
|
||||
$task = \core\task\manager::get_scheduled_task('\\tool_lp\\task\\sync_plans_from_template_cohorts_task');
|
||||
$this->assertInstanceOf('\tool_lp\task\sync_plans_from_template_cohorts_task', $task);
|
||||
$task = \core\task\manager::get_scheduled_task('\\core\\task\\sync_plans_from_template_cohorts_task');
|
||||
$this->assertInstanceOf('\core\task\sync_plans_from_template_cohorts_task', $task);
|
||||
|
||||
// Add two more users to the cohort.
|
||||
cohort_add_member($cohort->id, $user3->id);
|
||||
@ -181,8 +181,8 @@ class tool_lp_task_testcase extends advanced_testcase {
|
||||
|
||||
$this->assertEquals(2, $created);
|
||||
|
||||
$task = \core\task\manager::get_scheduled_task('\\tool_lp\\task\\sync_plans_from_template_cohorts_task');
|
||||
$this->assertInstanceOf('\tool_lp\task\sync_plans_from_template_cohorts_task', $task);
|
||||
$task = \core\task\manager::get_scheduled_task('\\core\\task\\sync_plans_from_template_cohorts_task');
|
||||
$this->assertInstanceOf('\core\task\sync_plans_from_template_cohorts_task', $task);
|
||||
|
||||
// Add two more users to the cohort.
|
||||
cohort_add_member($cohort->id, $user3->id);
|
||||
@ -248,7 +248,7 @@ class tool_lp_task_testcase extends advanced_testcase {
|
||||
$cohort = $dg->create_cohort();
|
||||
$tpl = $lpg->create_template(array('duedate' => time() + 1000));
|
||||
$templatecohort = api::create_template_cohort($tpl->get_id(), $cohort->id);
|
||||
$task = \core\task\manager::get_scheduled_task('\\tool_lp\\task\\sync_plans_from_template_cohorts_task');
|
||||
$task = \core\task\manager::get_scheduled_task('\\core\\task\\sync_plans_from_template_cohorts_task');
|
||||
|
||||
// Add 1 user to the cohort.
|
||||
cohort_add_member($cohort->id, $user1->id);
|
||||
@ -296,8 +296,8 @@ class tool_lp_task_testcase extends advanced_testcase {
|
||||
$DB->update_record(plan::TABLE, $record1);
|
||||
$DB->update_record(plan::TABLE, $record2);
|
||||
|
||||
$task = \core\task\manager::get_scheduled_task('\\tool_lp\\task\\complete_plans_task');
|
||||
$this->assertInstanceOf('\\tool_lp\\task\\complete_plans_task', $task);
|
||||
$task = \core\task\manager::get_scheduled_task('\\core\\task\\complete_plans_task');
|
||||
$this->assertInstanceOf('\\core\\task\\complete_plans_task', $task);
|
||||
|
||||
// Test that draft plan can not be completed on running task.
|
||||
$task->execute();
|
||||
|
@ -17,12 +17,12 @@
|
||||
/**
|
||||
* Complete plans task.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @package core_competency
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_lp\task;
|
||||
namespace core\task;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_lp\api;
|
@ -17,12 +17,12 @@
|
||||
/**
|
||||
* Synchronise plans from template cohorts.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @package core_competency
|
||||
* @copyright 2015 Issam Taboubi <issam.taboubi@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_lp\task;
|
||||
namespace core\task;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_lp\api;
|
@ -319,5 +319,23 @@ $tasks = array(
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'classname' => 'core\task\complete_plans_task',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'core\task\sync_plans_from_template_cohorts_task',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user