Skip to content

Commit

Permalink
MDLUM-8024 - MDL 3.11 - Partager nos plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
levemar committed Sep 21, 2022
1 parent a9d1d65 commit 4bfa60c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion classes/cohortmembersync.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected function process_file() {
}

// Check correct formatting of operation field.
if ($fields[0] !== "add" and $fields[0] !== "del") {
if ($fields[0] !== "add" && $fields[0] !== "del") {
$this->warnings[] = "Unknown operation in field 1 - ignoring line $line";
continue;
}
Expand Down
1 change: 0 additions & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_cohortsync\privacy;
defined('MOODLE_INTERNAL') || die();

/**
* Provider for tool_cohortsync.
Expand Down
2 changes: 0 additions & 2 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

9 changes: 4 additions & 5 deletions tests/cohortmembersync_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* @author Issam Taboubi <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use tool_cohortsync\cohortmembersync;

namespace tool_cohortsync;

defined('MOODLE_INTERNAL') || die();

Expand All @@ -39,7 +38,7 @@
* @author Issam Taboubi <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_cohortmembersync_testcase extends advanced_testcase {
class cohortmembersync_test extends \advanced_testcase {

/** @var progress_trace trace */
protected $trace = null;
Expand Down Expand Up @@ -88,8 +87,8 @@ public function setUp(): void {
$this->cat1 = $this->getDataGenerator()->create_category(array('name' => 'CAT1'));
$this->cat2 = $this->getDataGenerator()->create_category(array('name' => 'CAT2'));

$this->contextcat1 = context_coursecat::instance($this->cat1->id);
$this->contextcat2 = context_coursecat::instance($this->cat2->id);
$this->contextcat1 = \context_coursecat::instance($this->cat1->id);
$this->contextcat2 = \context_coursecat::instance($this->cat2->id);

$this->cohort1 = $this->getDataGenerator()->create_cohort(array(
'name' => 'Cohort1',
Expand Down
39 changes: 19 additions & 20 deletions tests/cohortsync_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* @author Issam Taboubi <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use tool_cohortsync\cohortsync;

namespace tool_cohortsync;

defined('MOODLE_INTERNAL') || die();

Expand All @@ -39,7 +38,7 @@
* @author Issam Taboubi <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_cohortsync_testcase extends advanced_testcase {
class cohortsync_test extends \advanced_testcase {

/** @var progress_trace trace */
protected $trace = null;
Expand Down Expand Up @@ -99,8 +98,8 @@ public function test_cohortsync_with_column_category_as_name() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand Down Expand Up @@ -138,8 +137,8 @@ public function test_cohortsync_with_column_category_as_id() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand Down Expand Up @@ -176,8 +175,8 @@ public function test_cohortsync_with_column_category_as_idnumber() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand All @@ -193,8 +192,8 @@ public function test_cohortsync_with_column_contextid() {
$cat1 = $this->getDataGenerator()->create_category(array('name' => 'CAT1'));
$cat2 = $this->getDataGenerator()->create_category(array('name' => 'CAT2'));

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$cohorts = array();
$cohorts[] = array('cohort name 1', 'cohortid1', 'first description', 1, $contextcat1->id);
Expand Down Expand Up @@ -252,8 +251,8 @@ public function test_cohortsync_with_column_category_id() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand Down Expand Up @@ -290,8 +289,8 @@ public function test_cohortsync_with_column_category_idnumber() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand Down Expand Up @@ -328,8 +327,8 @@ public function test_cohortsync_with_column_category_path() {
$this->assertEquals('cohortid2', $cohort2->idnumber);
$this->assertEquals('cohortid3', $cohort3->idnumber);

$contextcat1 = context_coursecat::instance($cat1->id);
$contextcat2 = context_coursecat::instance($cat2->id);
$contextcat1 = \context_coursecat::instance($cat1->id);
$contextcat2 = \context_coursecat::instance($cat2->id);

$this->assertEquals($contextcat1->id, $cohort1->contextid);
$this->assertEquals($contextcat2->id, $cohort2->contextid);
Expand All @@ -343,7 +342,7 @@ public function test_cohortsync_with_defaultcontext() {
global $DB;

$defaultcat = $this->getDataGenerator()->create_category(array('name' => 'DEFAULTCAT'));
$contextdefault = context_coursecat::instance($defaultcat->id);
$contextdefault = \context_coursecat::instance($defaultcat->id);

$cohorts = array();
$cohorts[] = array('cohort name 1', 'cohortid1', 'first description', 1);
Expand Down Expand Up @@ -385,7 +384,7 @@ public function test_cohortsync_no_defaultcontext() {

$this->assertEquals('cohortid1', $cohort1->idnumber);

$contextsystem = context_system::instance();
$contextsystem = \context_system::instance();
$this->assertEquals($contextsystem->id, $cohort1->contextid);
}

Expand Down Expand Up @@ -488,7 +487,7 @@ public function test_cohortsync_warnings_when_notfoundcategory() {
$cohort1 = $DB->get_record('cohort', array('idnumber' => 'cohortid1'));

$this->assertEquals('cohortid1', $cohort1->idnumber);
$contextsystem = context_system::instance();
$contextsystem = \context_system::instance();
$this->assertEquals($contextsystem->id, $cohort1->contextid);
}

Expand Down

0 comments on commit 4bfa60c

Please sign in to comment.