Skip to content

Commit

Permalink
rename adler testcase base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Glutamat42 committed Apr 2, 2024
1 parent 7fc8cfc commit eb0a714
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 38 deletions.
4 changes: 2 additions & 2 deletions tests/adler_score_helpers_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

global $CFG;

use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use local_adler\lib\static_mock_utilities_trait;
use local_adler\local\exceptions\not_an_adler_cm_exception;
use moodle_exception;
Expand All @@ -22,7 +22,7 @@ public function __construct(object $course_module, int $user_id = null) {
}


class adler_score_helpers_test extends local_adler_testcase {
class adler_score_helpers_test extends adler_testcase {
public function tearDown(): void {
parent::tearDown();

Expand Down
5 changes: 3 additions & 2 deletions tests/adler_score_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use coding_exception;
use completion_info;
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use local_adler\lib\static_mock_utilities_trait;
use local_adler\local\exceptions\user_not_enrolled_exception;
use local_logging\logger;
Expand Down Expand Up @@ -58,7 +58,8 @@ public function test_get_score_item() {
}


class adler_score_test extends local_adler_testcase {
class adler_score_test extends adler_testcase {
// TODO: Deprecated: Creation of dynamic property local_adler\adler_score_test::$course is deprecated in /home/runner/work/MoodlePluginLocal/MoodlePluginLocal/moodle/local/adler/tests/adler_score_test.php on line 69 (https://github.com/ProjektAdLer/MoodlePluginLocal/actions/runs/7917995524/job/21615389855)
public function setUp(): void {
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
// When using namespaces, the namespace of the test class should match the namespace of the code under test
// -> no namespace for this test as backup/restore is not namespaced
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;

global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');
Expand All @@ -14,7 +14,7 @@
* The only way to reliably recreate this object would be using the same code as the original class.
* Therefore, this test is implemented as an integration test.
*/
class backup_local_adler_plugin_test extends local_adler_testcase {
class backup__adler_plugin_test extends adler_testcase {
public function setUp(): void {
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// When using namespaces, the namespace of the test class should match the namespace of the code under test
// -> no namespace for this test as backup/restore is not namespaced

use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;

global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');
Expand All @@ -13,7 +13,7 @@
/**
* PHPunit test for class restore_local_adler_plugin
*/
class restore_local_adler_plugin_test extends local_adler_testcase {
class restore__adler_plugin_test extends adler_testcase {
public function setUpModule(): array {
// stub the get_task() method to return a mock task object
$stub_task = $this->getMockBuilder(restore_activity_task::class)
Expand Down
4 changes: 2 additions & 2 deletions tests/external/get_element_ids_by_uuids_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use context_module;
use dml_exception;
use invalid_parameter_exception;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;
use Mockery;
use ReflectionClass;
use local_adler\local\section\db as section_db;
Expand All @@ -20,7 +20,7 @@
/**
* @runTestsInSeparateProcesses
*/
class get_element_ids_by_uuids_test extends local_adler_externallib_testcase {
class get_element_ids_by_uuids_test extends adler_externallib_testcase {
public function provide_test_execute_data() {
return [
'cm' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/external/lib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

use external_api;
use invalid_parameter_exception;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;

/**
* @runTestsInSeparateProcesses
*/
class lib_test extends local_adler_externallib_testcase {
class lib_test extends adler_externallib_testcase {
/**
* @param $class_to_test string|null Exactly this function is required in different API classes because they require a proxy function to this function. Therefore, this test is also valid for those API classes. This parameter allows exactly this. Pass the class name via classname::class.
* @return void
Expand Down
4 changes: 2 additions & 2 deletions tests/external/score_get_course_scores_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use context_module;
use local_adler\adler_score_helpers;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;
use Mockery;
use ReflectionClass;

Expand All @@ -16,7 +16,7 @@
/**
* @runTestsInSeparateProcesses
*/
class score_get_course_scores_test extends local_adler_externallib_testcase {
class score_get_course_scores_test extends adler_externallib_testcase {
public function provide_test_execute_data() {
return [
'success' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/external/score_get_element_scores_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use dml_missing_record_exception;
use invalid_parameter_exception;
use local_adler\adler_score_helpers_mock;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;
use moodle_exception;
use require_login_exception;
use Throwable;
Expand All @@ -21,7 +21,7 @@
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class score_get_element_scores_test extends local_adler_externallib_testcase {
class score_get_element_scores_test extends adler_externallib_testcase {
public function test_execute() {
global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/mocks.php');
Expand Down
4 changes: 2 additions & 2 deletions tests/external/score_h5p_learning_element_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use context_module;
use local_adler\adler_score_helpers;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;
use Mockery;
use moodle_exception;
use ReflectionClass;
Expand All @@ -23,7 +23,7 @@
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class score_h5p_learning_element_test extends local_adler_externallib_testcase {
class score_h5p_learning_element_test extends adler_externallib_testcase {
public function provide_test_get_module_ids_from_xapi_data() {
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/external/score_primitive_learning_element_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use external_api;
use invalid_parameter_exception;
use local_adler\adler_score;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;


global $CFG;
Expand All @@ -20,7 +20,7 @@
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class score_primitive_learning_element_test extends local_adler_externallib_testcase {
class score_primitive_learning_element_test extends adler_externallib_testcase {
// Define the properties explicitly
public $course;
public $course_module;
Expand Down
4 changes: 2 additions & 2 deletions tests/external/upload_course_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use backup;
use backup_controller;
use invalid_parameter_exception;
use local_adler\lib\local_adler_externallib_testcase;
use local_adler\lib\adler_externallib_testcase;
use local_adler\local\exceptions\not_an_adler_course_exception;
use moodle_exception;

Expand All @@ -17,7 +17,7 @@
/**
* @runTestsInSeparateProcesses
*/
class upload_course_test extends local_adler_externallib_testcase {
class upload_course_test extends adler_externallib_testcase {
public function generate_mbz(bool $is_adler_course): string {
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace local_adler;


use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use local_adler\lib\static_mock_utilities_trait; # import for other classes importing this class
use moodle_exception;
use Throwable;


class helpers_test extends local_adler_testcase {
class helpers_test extends adler_testcase {
public function provide_test_course_is_adler_course_data(): array {
return [
'is adler course' => [['course_exist' => true, 'is_adler_course' => true, 'expected' => true]],
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/adler_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function tearDown(): void {
}
}

abstract class local_adler_testcase extends advanced_testcase {
abstract class adler_testcase extends advanced_testcase {
use general_testcase_adjustments;
}

abstract class local_adler_externallib_testcase extends externallib_advanced_testcase {
abstract class adler_externallib_testcase extends externallib_advanced_testcase {
use general_testcase_adjustments {
general_testcase_adjustments::setUp as protected setUpTrait;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/local/course_module/db_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


use dml_exception;
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;

global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');


class db_test extends local_adler_testcase {
class db_test extends adler_testcase {
public function setUp(): void {
parent::setUp();
$this->adler_generator = $this->getDataGenerator()->get_plugin_generator('local_adler');
Expand Down
4 changes: 2 additions & 2 deletions tests/local/section/db_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@


use dml_exception;
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use Mockery;

global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');


class db_test extends local_adler_testcase {
class db_test extends adler_testcase {
public function setUp(): void {
parent::setUp();
$this->adler_generator = $this->getDataGenerator()->get_plugin_generator('local_adler');
Expand Down
4 changes: 2 additions & 2 deletions tests/local/section/section_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

use completion_info;
use local_adler\adler_score_helpers;
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use local_adler\local\exceptions\not_an_adler_section_exception;
use ReflectionClass;

global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');


class section_test extends local_adler_testcase {
class section_test extends adler_testcase {
public function provide_test_construct_data() {
return [
'valid section' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/observer_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
use core\event\course_deleted;
use core\event\course_module_deleted;
use core\event\course_section_deleted;
use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;


global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');

class observer_test extends local_adler_testcase {
class observer_test extends adler_testcase {

public function test_course_content_deleted() {
global $DB;
Expand Down
4 changes: 2 additions & 2 deletions tests/plugin_interface_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');


use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;
use local_adler\local\section\section;
use local_adler\local\section\db as section_db;
use Mockery;


class plugin_interface_test extends local_adler_testcase {
class plugin_interface_test extends adler_testcase {
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
Expand Down
4 changes: 2 additions & 2 deletions tests/uninstall_test.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php


use local_adler\lib\local_adler_testcase;
use local_adler\lib\adler_testcase;


global $CFG;
require_once($CFG->dirroot . '/local/adler/tests/lib/adler_testcase.php');
require_once($CFG->dirroot . '/local/adler/db/uninstall.php');

class uninstall_test extends local_adler_testcase {
class uninstall_test extends adler_testcase {
public function test_xmldb_local_adler_uninstall() {
global $DB;

Expand Down

0 comments on commit eb0a714

Please sign in to comment.