From 648bae38d76ba35e35e7d89b2374b53ad0b0ee27 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Fri, 22 Mar 2024 17:59:47 +0100 Subject: [PATCH] Codestyle PHPCBF --- db/caches.php | 4 ++-- step/createbackup/classes/privacy/provider.php | 2 +- step/deletecourse/classes/privacy/provider.php | 2 +- step/duplicate/classes/privacy/provider.php | 2 +- step/email/tests/privacy/provider_test.php | 6 +++--- tests/active_workflow_is_manual_test.php | 8 ++++---- tests/active_workflow_sortindex_updown_test.php | 14 +++++++------- tests/backup_and_restore_workflow_test.php | 6 +++--- tests/backup_manager_test.php | 8 ++++---- tests/manual_trigger_tools_test.php | 8 ++++---- tests/manually_triggered_process_test.php | 6 +++--- tests/persistence/persist_process_data_test.php | 6 +++--- tests/persistence/persist_process_test.php | 12 ++++++------ tests/persistence/persist_step_test.php | 12 ++++++------ tests/persistence/persist_workflow_test.php | 6 +++--- tests/privacy_test.php | 16 ++++++++-------- tests/process_error_test.php | 6 +++--- tests/process_status_message_test.php | 6 +++--- tests/settings_manager_test.php | 10 +++++----- tests/workflow_actions_testcase.php | 2 +- .../workflow_activate_disable_duplicate_test.php | 12 ++++++------ trigger/categories/classes/privacy/provider.php | 2 +- trigger/categories/tests/trigger_test.php | 10 +++++----- .../delayedcourses/classes/privacy/provider.php | 2 +- trigger/delayedcourses/tests/trigger_test.php | 14 +++++++------- trigger/manual/classes/privacy/provider.php | 2 +- trigger/sitecourse/classes/privacy/provider.php | 2 +- trigger/sitecourse/tests/trigger_test.php | 8 ++++---- .../specificdate/classes/privacy/provider.php | 2 +- .../startdatedelay/classes/privacy/provider.php | 2 +- trigger/startdatedelay/tests/trigger_test.php | 8 ++++---- 31 files changed, 103 insertions(+), 103 deletions(-) diff --git a/db/caches.php b/db/caches.php index a475590c..40b6edce 100644 --- a/db/caches.php +++ b/db/caches.php @@ -31,6 +31,6 @@ 'application' => [ 'mode' => cache_store::MODE_APPLICATION, 'simplekeys' => true, - 'simpledata' => true - ] + 'simpledata' => true, + ], ]; diff --git a/step/createbackup/classes/privacy/provider.php b/step/createbackup/classes/privacy/provider.php index 306f0a82..9fba71a4 100644 --- a/step/createbackup/classes/privacy/provider.php +++ b/step/createbackup/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/step/deletecourse/classes/privacy/provider.php b/step/deletecourse/classes/privacy/provider.php index 6ab29e62..affe4e59 100644 --- a/step/deletecourse/classes/privacy/provider.php +++ b/step/deletecourse/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/step/duplicate/classes/privacy/provider.php b/step/duplicate/classes/privacy/provider.php index 136ee7ca..b17e946e 100644 --- a/step/duplicate/classes/privacy/provider.php +++ b/step/duplicate/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/step/email/tests/privacy/provider_test.php b/step/email/tests/privacy/provider_test.php index feb35b6d..fcb8311e 100644 --- a/step/email/tests/privacy/provider_test.php +++ b/step/email/tests/privacy/provider_test.php @@ -44,7 +44,7 @@ * @author Philipp Memmel * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class provider_test extends provider_testcase { +final class provider_test extends provider_testcase { /** * Basic setup for the provider tests. @@ -190,7 +190,7 @@ public function test_get_users_in_context(): void { * @return void * @throws dml_exception */ - public function test_delete_data_for_users() { + public function test_delete_data_for_users(): void { global $DB; $approveduserlist = new approved_userlist(context_system::instance(), 'lifecyclestep_email', [$this->user1->id, $this->user2->id]); @@ -212,7 +212,7 @@ public function test_delete_data_for_users() { * @return void * @throws dml_exception */ - public function test_delete_data_for_users_coursecontext() { + public function test_delete_data_for_users_coursecontext(): void { global $DB; $approveduserlist = new approved_userlist(context_course::instance($this->course1->id), 'lifecyclestep_email', [$this->user1->id, $this->user2->id]); diff --git a/tests/active_workflow_is_manual_test.php b/tests/active_workflow_is_manual_test.php index 2e004264..1c502be0 100644 --- a/tests/active_workflow_is_manual_test.php +++ b/tests/active_workflow_is_manual_test.php @@ -40,7 +40,7 @@ * @copyright 2018 WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class active_workflow_is_manual_test extends \advanced_testcase { +final class active_workflow_is_manual_test extends \advanced_testcase { /** Icon of the trigger. */ const MANUAL_TRIGGER1_ICON = 't/up'; @@ -58,7 +58,7 @@ class active_workflow_is_manual_test extends \advanced_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; $this->resetAfterTest(true); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -85,7 +85,7 @@ public function setUp() : void { * @throws \dml_transaction_exception * @throws \moodle_exception */ - public function test_activate_manual() { + public function test_activate_manual(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->manualworkflow->id); $reloadworkflow = workflow_manager::get_workflow($this->manualworkflow->id); $this->assertTrue(workflow_manager::is_active($this->manualworkflow->id)); @@ -100,7 +100,7 @@ public function test_activate_manual() { * @throws \dml_transaction_exception * @throws \moodle_exception */ - public function test_activate_automatic() { + public function test_activate_automatic(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->automaticworkflow->id); $reloadworkflow = workflow_manager::get_workflow($this->automaticworkflow->id); $this->assertTrue(workflow_manager::is_active($this->automaticworkflow->id)); diff --git a/tests/active_workflow_sortindex_updown_test.php b/tests/active_workflow_sortindex_updown_test.php index e43eb80b..7aecda2f 100644 --- a/tests/active_workflow_sortindex_updown_test.php +++ b/tests/active_workflow_sortindex_updown_test.php @@ -41,13 +41,13 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class active_workflow_sortindex_updown_test extends workflow_actions_testcase { +final class active_workflow_sortindex_updown_test extends workflow_actions_testcase { /** * Test to put down the first workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions down */ - public function test_down_first() { + public function test_down_first(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -67,7 +67,7 @@ public function test_down_first() { * Test to put down the second workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions down */ - public function test_down_second() { + public function test_down_second(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -87,7 +87,7 @@ public function test_down_second() { * Test to put down the third workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions down */ - public function test_down_third() { + public function test_down_third(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -107,7 +107,7 @@ public function test_down_third() { * Test to put up the third workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions up */ - public function test_up_first() { + public function test_up_first(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -127,7 +127,7 @@ public function test_up_first() { * Test to put up the third workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions up */ - public function test_up_second() { + public function test_up_second(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -147,7 +147,7 @@ public function test_up_second() { * Test to put up the third workflow. * @covers \tool_lifecycle\local\manager\workflow_manager move actions up */ - public function test_up_third() { + public function test_up_third(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); diff --git a/tests/backup_and_restore_workflow_test.php b/tests/backup_and_restore_workflow_test.php index 2472092b..282a0f1d 100644 --- a/tests/backup_and_restore_workflow_test.php +++ b/tests/backup_and_restore_workflow_test.php @@ -44,7 +44,7 @@ * @copyright 2018 WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class backup_and_restore_workflow_test extends \advanced_testcase { +final class backup_and_restore_workflow_test extends \advanced_testcase { /** @var $workflow workflow */ private $workflow; @@ -56,7 +56,7 @@ class backup_and_restore_workflow_test extends \advanced_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); $this->workflow = $generator->create_workflow(['startdatedelay', 'categories'], ['email', 'createbackup', 'deletecourse']); @@ -69,7 +69,7 @@ public function setUp() : void { * Test to activate the manual workflow. * @covers \tool_lifecycle\local\manager\workflow_manager check if backup is created */ - public function test_backup_workflow() { + public function test_backup_workflow(): void { $backuptask = new backup_lifecycle_workflow($this->workflow->id); $backuptask->execute(); $filename = $backuptask->get_temp_filename(); diff --git a/tests/backup_manager_test.php b/tests/backup_manager_test.php index 2ed76032..ce192f9b 100644 --- a/tests/backup_manager_test.php +++ b/tests/backup_manager_test.php @@ -34,7 +34,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class backup_manager_test extends \advanced_testcase { +final class backup_manager_test extends \advanced_testcase { /** @var array $course Instance of the course under test. */ private $course; @@ -42,7 +42,7 @@ class backup_manager_test extends \advanced_testcase { /** * Setup the testcase. */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(false); $this->course = $this->getDataGenerator()->create_course(); } @@ -51,7 +51,7 @@ public function setUp() : void { * Test creating a backup for a course. * @covers \tool_lifecycle\local\manager\backup_manager create backup */ - public function test_backup_create() { + public function test_backup_create(): void { global $DB; $result = backup_manager::create_course_backup($this->course->id); $this->assertTrue($result); @@ -63,7 +63,7 @@ public function test_backup_create() { * Test redirect without errors when starting to restore a backup. * @covers \tool_lifecycle\local\manager\backup_manager restore backup */ - public function test_backup_restore() { + public function test_backup_restore(): void { global $DB; $backups = $DB->get_records('tool_lifecycle_backups'); $this->assertEquals(1, count($backups)); diff --git a/tests/manual_trigger_tools_test.php b/tests/manual_trigger_tools_test.php index db905e01..d20f037a 100644 --- a/tests/manual_trigger_tools_test.php +++ b/tests/manual_trigger_tools_test.php @@ -38,7 +38,7 @@ * @copyright 2018 Tobias Reischmann, Jan Dageforde WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class manual_trigger_tools_test extends \advanced_testcase { +final class manual_trigger_tools_test extends \advanced_testcase { /** Icon of the manual trigger 1. */ const MANUAL_TRIGGER1_ICON = 't/up'; /** Display name of the manual trigger 1. */ @@ -62,7 +62,7 @@ class manual_trigger_tools_test extends \advanced_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; $this->resetAfterTest(true); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -87,7 +87,7 @@ public function setUp() : void { * Test getting manual trigger tools of active workflows. * @covers \tool_lifecycle\local\manager\workflow_manager get triggers for one wf */ - public function test_get_manual_trigger_tools_for_one_active_workflow() { + public function test_get_manual_trigger_tools_for_one_active_workflow(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); $tools = workflow_manager::get_manual_trigger_tools_for_active_workflows(); $this->assertCount(1, $tools); @@ -102,7 +102,7 @@ public function test_get_manual_trigger_tools_for_one_active_workflow() { * Test getting manual trigger tools of active workflows. * @covers \tool_lifecycle\local\manager\workflow_manager get triggers for multiple wf */ - public function test_get_manual_trigger_tools_for_active_workflows() { + public function test_get_manual_trigger_tools_for_active_workflows(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); $tools = workflow_manager::get_manual_trigger_tools_for_active_workflows(); diff --git a/tests/manually_triggered_process_test.php b/tests/manually_triggered_process_test.php index b231ca24..104014e0 100644 --- a/tests/manually_triggered_process_test.php +++ b/tests/manually_triggered_process_test.php @@ -47,7 +47,7 @@ * @copyright 2018 WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class manually_triggered_process_test extends \advanced_testcase { +final class manually_triggered_process_test extends \advanced_testcase { /** Icon of the manual trigger. */ const MANUAL_TRIGGER1_ICON = 't/up'; /** Display name of the manual trigger. */ @@ -66,7 +66,7 @@ class manually_triggered_process_test extends \advanced_testcase { * @throws \coding_exception * @throws \moodle_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; // We do not need a sesskey check in theses tests. @@ -95,7 +95,7 @@ public function setUp() : void { * Test to proceed a manually triggered process to step index 1. * @covers \tool_lifecycle\local\manager\process_manager test if manual process started */ - public function test_proceeding_of_manually_triggered_processes() { + public function test_proceeding_of_manually_triggered_processes(): void { $process = process_manager::manually_trigger_process($this->course->id, $this->trigger->id); $this->assertEquals(0, $process->stepindex); diff --git a/tests/persistence/persist_process_data_test.php b/tests/persistence/persist_process_data_test.php index b76f67be..9c40aec6 100644 --- a/tests/persistence/persist_process_data_test.php +++ b/tests/persistence/persist_process_data_test.php @@ -40,7 +40,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class persist_process_data_test extends \advanced_testcase { +final class persist_process_data_test extends \advanced_testcase { /** @var process $process Instance of the process. */ private $process; @@ -55,7 +55,7 @@ class persist_process_data_test extends \advanced_testcase { * @throws coding_exception * @throws dml_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -70,7 +70,7 @@ public function setUp() : void { * Test the getting and setting of process data. * @covers \tool_lifecycle\local\manager\process_data_manager */ - public function test_get_set_process_data() { + public function test_get_set_process_data(): void { $step = step_manager::get_step_instance_by_workflow_index($this->process->workflowid, $this->process->stepindex); process_data_manager::set_process_data( $this->process->id, diff --git a/tests/persistence/persist_process_test.php b/tests/persistence/persist_process_test.php index 2915ab55..54180ce7 100644 --- a/tests/persistence/persist_process_test.php +++ b/tests/persistence/persist_process_test.php @@ -39,7 +39,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class persist_process_test extends \advanced_testcase { +final class persist_process_test extends \advanced_testcase { /** @var workflow $workflow Instance of the workflow. */ private $workflow; @@ -51,7 +51,7 @@ class persist_process_test extends \advanced_testcase { * Setup the testcase. * @throws coding_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -63,7 +63,7 @@ public function setUp() : void { * Test the creation of a process. * @covers \tool_lifecycle\local\manager\process_manager */ - public function test_create() { + public function test_create(): void { $process = process_manager::create_process($this->course->id, $this->workflow->id); $this->assertNotNull($process); $this->assertNotEmpty($process->id); @@ -77,7 +77,7 @@ public function test_create() { * Tests setting a process on waiting. * @covers \tool_lifecycle\local\manager\process_manager */ - public function test_process_waiting() { + public function test_process_waiting(): void { $process = process_manager::create_process($this->course->id, $this->workflow->id); $this->assertFalse($process->waiting); process_manager::set_process_waiting($process); @@ -89,7 +89,7 @@ public function test_process_waiting() { * Tests deletion of a process when rolledback. * @covers \tool_lifecycle\local\manager\process_manager */ - public function test_process_rollback() { + public function test_process_rollback(): void { $process = process_manager::create_process($this->course->id, $this->workflow->id); delayed_courses_manager::set_course_delayed($process->courseid, get_config('tool_lifecycle', 'duration')); process_manager::rollback_process($process); @@ -101,7 +101,7 @@ public function test_process_rollback() { * Tests proceeding a process to the next step. * @covers \tool_lifecycle\local\manager\process_manager */ - public function test_process_proceed() { + public function test_process_proceed(): void { $process = process_manager::create_process($this->course->id, $this->workflow->id); $this->assertEquals(0, $process->stepindex); process_manager::proceed_process($process); diff --git a/tests/persistence/persist_step_test.php b/tests/persistence/persist_step_test.php index bc830a0a..b5e5e8c9 100644 --- a/tests/persistence/persist_step_test.php +++ b/tests/persistence/persist_step_test.php @@ -39,7 +39,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class persist_step_test extends \advanced_testcase { +final class persist_step_test extends \advanced_testcase { /** @var workflow $workflow Instance of the workflow. */ private $workflow; @@ -52,7 +52,7 @@ class persist_step_test extends \advanced_testcase { * @throws coding_exception * @throws moodle_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $this->generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -63,7 +63,7 @@ public function setUp() : void { * Test that after an insert the id from the database is set within the step object. * @covers \tool_lifecycle\local\manager\step_manager */ - public function test_add_step() { + public function test_add_step(): void { $step = $this->generator->create_step( 'instance1', 'subpluginname', @@ -77,7 +77,7 @@ public function test_add_step() { * Test that sortindizes are created correclty when creating multiple steps. * @covers \tool_lifecycle\local\manager\step_manager */ - public function test_add_multiple_steps() { + public function test_add_multiple_steps(): void { $step1 = $this->generator->create_step( 'instance1', 'subpluginname', @@ -99,7 +99,7 @@ public function test_add_multiple_steps() { * Test that the step can be removed correctly. * @covers \tool_lifecycle\local\manager\step_manager */ - public function test_remove_step() { + public function test_remove_step(): void { $step1 = $this->generator->create_step( 'instance1', 'subpluginname', @@ -132,7 +132,7 @@ public function test_remove_step() { * Test that sortindizes are still created correctly, when some steps were already removed. * @covers \tool_lifecycle\local\manager\step_manager */ - public function test_add_after_remove_step() { + public function test_add_after_remove_step(): void { $step1 = $this->generator->create_step( 'instance1', 'subpluginname', diff --git a/tests/persistence/persist_workflow_test.php b/tests/persistence/persist_workflow_test.php index f4109c55..ed2438bb 100644 --- a/tests/persistence/persist_workflow_test.php +++ b/tests/persistence/persist_workflow_test.php @@ -38,7 +38,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class persist_workflow_test extends \advanced_testcase { +final class persist_workflow_test extends \advanced_testcase { /** @var workflow $workflow Instance of the workflow. */ private $workflow; @@ -46,7 +46,7 @@ class persist_workflow_test extends \advanced_testcase { /** * Setup the testcase. */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $record = new \stdClass(); $record->id = null; @@ -58,7 +58,7 @@ public function setUp() : void { * Test the creation of a process. * @covers \tool_lifecycle\local\manager\workflow_manager create a wf. */ - public function test_create() { + public function test_create(): void { $this->assertNull($this->workflow->id); workflow_manager::insert_or_update($this->workflow); $this->assertNotNull($this->workflow->id); diff --git a/tests/privacy_test.php b/tests/privacy_test.php index 6e9d76af..b2eedf4f 100644 --- a/tests/privacy_test.php +++ b/tests/privacy_test.php @@ -49,7 +49,7 @@ * @copyright 2019 Justus Dieckmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class privacy_test extends provider_testcase { +final class privacy_test extends provider_testcase { /** Icon of the manual trigger. */ @@ -75,7 +75,7 @@ class privacy_test extends provider_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; // We do not need a sesskey check in theses tests. @@ -100,7 +100,7 @@ public function setUp() : void { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_get_contexts_for_userid() { + public function test_get_contexts_for_userid(): void { $c1 = $this->getDataGenerator()->create_course(); $c2 = $this->getDataGenerator()->create_course(); $u1 = $this->getDataGenerator()->create_user(); @@ -130,7 +130,7 @@ public function test_get_contexts_for_userid() { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_export_user_data() { + public function test_export_user_data(): void { $c1 = $this->getDataGenerator()->create_course(); $c2 = $this->getDataGenerator()->create_course(); $u1 = $this->getDataGenerator()->create_user(); @@ -169,7 +169,7 @@ public function test_export_user_data() { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_delete_data_for_all_users_in_context() { + public function test_delete_data_for_all_users_in_context(): void { global $DB; $c1 = $this->getDataGenerator()->create_course(); $u1 = $this->getDataGenerator()->create_user(); @@ -195,7 +195,7 @@ public function test_delete_data_for_all_users_in_context() { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_delete_data_for_user() { + public function test_delete_data_for_user(): void { global $DB; $c1 = $this->getDataGenerator()->create_course(); $c2 = $this->getDataGenerator()->create_course(); @@ -229,7 +229,7 @@ public function test_delete_data_for_user() { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_get_users_in_context() { + public function test_get_users_in_context(): void { $c1 = $this->getDataGenerator()->create_course(); $c2 = $this->getDataGenerator()->create_course(); $u1 = $this->getDataGenerator()->create_user(); @@ -258,7 +258,7 @@ public function test_get_users_in_context() { * @throws \invalid_parameter_exception * @throws \moodle_exception */ - public function test_delete_data_for_users() { + public function test_delete_data_for_users(): void { global $DB; $c1 = $this->getDataGenerator()->create_course(); $c2 = $this->getDataGenerator()->create_course(); diff --git a/tests/process_error_test.php b/tests/process_error_test.php index a4ca2d5c..49259054 100644 --- a/tests/process_error_test.php +++ b/tests/process_error_test.php @@ -41,7 +41,7 @@ * @copyright 2022 Justus Dieckmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class process_error_test extends \advanced_testcase { +final class process_error_test extends \advanced_testcase { /** Icon of the manual trigger. */ const MANUAL_TRIGGER1_ICON = 't/up'; /** Display name of the manual trigger. */ @@ -60,7 +60,7 @@ class process_error_test extends \advanced_testcase { * @throws \coding_exception * @throws \moodle_exception */ - public function setUp() : void { + public function setUp(): void { global $USER, $DB; // We do not need a sesskey check in theses tests. @@ -92,7 +92,7 @@ public function setUp() : void { * Test if the correct process error was put into the table. * @covers \tool_lifecycle\processor */ - public function test_process_error_in_table() { + public function test_process_error_in_table(): void { global $DB; $process = process_manager::manually_trigger_process($this->course->id, $this->trigger->id); diff --git a/tests/process_status_message_test.php b/tests/process_status_message_test.php index dad40e11..ecb0855a 100644 --- a/tests/process_status_message_test.php +++ b/tests/process_status_message_test.php @@ -35,7 +35,7 @@ * @copyright 2018 Tamara Gunkel, Jan Dageforde WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class process_status_message_test extends \advanced_testcase { +final class process_status_message_test extends \advanced_testcase { /** Icon of the manual trigger. */ const MANUAL_TRIGGER1_ICON = 't/up'; /** Display name of the manual trigger. */ @@ -53,7 +53,7 @@ class process_status_message_test extends \advanced_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; // We do not need a sesskey check in theses tests. @@ -76,7 +76,7 @@ public function setUp() : void { * Test getting status message for a process. * @covers \tool_lifecycle\local\manager\interaction_manager */ - public function test_get_status_message() { + public function test_get_status_message(): void { $process = $this->generator->create_process(2, $this->workflow->id); $message = \tool_lifecycle\local\manager\interaction_manager::get_process_status_message($process->id); $this->assertEquals(get_string("workflow_started", "tool_lifecycle"), $message); diff --git a/tests/settings_manager_test.php b/tests/settings_manager_test.php index 8fc4f09b..8a3372db 100644 --- a/tests/settings_manager_test.php +++ b/tests/settings_manager_test.php @@ -39,7 +39,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class settings_manager_test extends \advanced_testcase { +final class settings_manager_test extends \advanced_testcase { /** @var step_subplugin $step Instance of the step plugin. */ private $step; @@ -57,7 +57,7 @@ class settings_manager_test extends \advanced_testcase { * Setup the testcase. * @throws \coding_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(false); $generator = $this->getDataGenerator()->get_plugin_generator('tool_lifecycle'); @@ -71,7 +71,7 @@ public function setUp() : void { * Test setting and getting settings data for steps. * @covers \tool_lifecycle\local\manager\settings_manager */ - public function test_set_get_step_settings() { + public function test_set_get_step_settings(): void { $data = new \stdClass(); $data->subject = self::EMAIL_VALUE; settings_manager::save_settings($this->step->id, settings_type::STEP, $this->step->subpluginname, $data); @@ -84,7 +84,7 @@ public function test_set_get_step_settings() { * Test setting and getting settings data for triggers. * @covers \tool_lifecycle\local\manager\settings_manager */ - public function test_set_get_trigger_settings() { + public function test_set_get_trigger_settings(): void { $data = new \stdClass(); $data->delay = self::STARTDELAY_VALUE; settings_manager::save_settings($this->trigger->id, settings_type::TRIGGER, $this->trigger->subpluginname, $data); @@ -97,7 +97,7 @@ public function test_set_get_trigger_settings() { * Test correct removal of setting, if steps, triggers or workflows are deleted. * @covers \tool_lifecycle\local\manager\settings_manager */ - public function test_remove_workflow() { + public function test_remove_workflow(): void { global $DB; $data = new \stdClass(); $data->subject = self::EMAIL_VALUE; diff --git a/tests/workflow_actions_testcase.php b/tests/workflow_actions_testcase.php index 7403d130..e6f5b0ce 100644 --- a/tests/workflow_actions_testcase.php +++ b/tests/workflow_actions_testcase.php @@ -51,7 +51,7 @@ abstract class workflow_actions_testcase extends \advanced_testcase { * Setup the testcase. * @throws coding_exception */ - public function setUp() : void { + public function setUp(): void { global $USER; // We do not need a sesskey check in theses tests. $USER->ignoresesskey = true; diff --git a/tests/workflow_activate_disable_duplicate_test.php b/tests/workflow_activate_disable_duplicate_test.php index e48b37c0..a0acf658 100644 --- a/tests/workflow_activate_disable_duplicate_test.php +++ b/tests/workflow_activate_disable_duplicate_test.php @@ -42,13 +42,13 @@ * @copyright 2018 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class workflow_activate_disable_duplicate_test extends workflow_actions_testcase { +final class workflow_activate_disable_duplicate_test extends workflow_actions_testcase { /** * Test to activate the first workflow. * @covers \tool_lifecycle\local\manager\workflow_manager */ - public function test_activate_first() { + public function test_activate_first(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); $reloadworkflow = workflow_manager::get_workflow($this->workflow1->id); $this->assertTrue(workflow_manager::is_active($this->workflow1->id)); @@ -59,7 +59,7 @@ public function test_activate_first() { * Test to activate the first and the second workflow. * @covers \tool_lifecycle\local\manager\workflow_manager */ - public function test_activate_second() { + public function test_activate_second(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); @@ -72,7 +72,7 @@ public function test_activate_second() { * Test to activate all three workflow. * @covers \tool_lifecycle\local\manager\workflow_manager */ - public function test_activate_third() { + public function test_activate_third(): void { workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow1->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow2->id); workflow_manager::handle_action(action::WORKFLOW_ACTIVATE, $this->workflow3->id); @@ -86,7 +86,7 @@ public function test_activate_third() { * Test to deactivate the first workflow. * @covers \tool_lifecycle\local\manager\workflow_manager */ - public function test_deactivate_first() { + public function test_deactivate_first(): void { workflow_manager::handle_action(action::WORKFLOW_ABORTDISABLE, $this->workflow1->id); $this->assertFalse(workflow_manager::is_active($this->workflow1->id)); } @@ -95,7 +95,7 @@ public function test_deactivate_first() { * Test to duplicate the first workflow. * @covers \tool_lifecycle\local\manager\workflow_manager */ - public function test_duplicate_first() { + public function test_duplicate_first(): void { workflow_manager::handle_action(action::WORKFLOW_DUPLICATE, $this->workflow1->id); $workflows = workflow_manager::get_workflows(); $this->assertCount(4, $workflows); diff --git a/trigger/categories/classes/privacy/provider.php b/trigger/categories/classes/privacy/provider.php index 19da3d64..3eff6200 100644 --- a/trigger/categories/classes/privacy/provider.php +++ b/trigger/categories/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/categories/tests/trigger_test.php b/trigger/categories/tests/trigger_test.php index cda087c1..8187ec27 100644 --- a/trigger/categories/tests/trigger_test.php +++ b/trigger/categories/tests/trigger_test.php @@ -41,7 +41,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class trigger_test extends \advanced_testcase { +final class trigger_test extends \advanced_testcase { /** @var trigger_subplugin $excludetrigger Trigger instance that excludes a category. */ private $excludetrigger; @@ -60,7 +60,7 @@ class trigger_test extends \advanced_testcase { * Setup the testcase. * @throws \moodle_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); @@ -86,7 +86,7 @@ public function setUp() : void { * Tests if courses, which are in the category are correctly triggered. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\categories */ - public function test_course_has_cat() { + public function test_course_has_cat(): void { $course = $this->getDataGenerator()->create_course(['category' => $this->category->id]); @@ -111,7 +111,7 @@ public function test_course_has_cat() { * Tests if courses, which are in the category are correctly triggered. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\categories */ - public function test_course_within_cat() { + public function test_course_within_cat(): void { $course = $this->getDataGenerator()->create_course(['category' => $this->childcategory->id]); @@ -136,7 +136,7 @@ public function test_course_within_cat() { * Tests if courses, which are not in the category are correctly triggered. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\categories */ - public function test_course_not_within_cat() { + public function test_course_not_within_cat(): void { $course = $this->getDataGenerator()->create_course(); $recordset = $this->processor->get_course_recordset([$this->includetrigger], []); diff --git a/trigger/delayedcourses/classes/privacy/provider.php b/trigger/delayedcourses/classes/privacy/provider.php index 2befaf30..ab47a280 100644 --- a/trigger/delayedcourses/classes/privacy/provider.php +++ b/trigger/delayedcourses/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/delayedcourses/tests/trigger_test.php b/trigger/delayedcourses/tests/trigger_test.php index ed8dedf0..162d1282 100644 --- a/trigger/delayedcourses/tests/trigger_test.php +++ b/trigger/delayedcourses/tests/trigger_test.php @@ -43,7 +43,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class trigger_test extends \advanced_testcase { +final class trigger_test extends \advanced_testcase { /** @var trigger_subplugin $triggerinstance Instance of the delayedcourses trigger. */ private $triggerinstance; @@ -57,7 +57,7 @@ class trigger_test extends \advanced_testcase { /** @var workflow Workflow delaying processes for all workflows */ private $workflowdealayingallworkflows; - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); @@ -71,7 +71,7 @@ public function setUp() : void { * Tests that a course is not excluded by this plugin, when there exists no dalayed entry, yet. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\delayedcourses */ - public function test_course_not_delayed() { + public function test_course_not_delayed(): void { $course = $this->getDataGenerator()->create_course(); @@ -90,7 +90,7 @@ public function test_course_not_delayed() { * Tests that a course is excluded by this plugin, when there exists a dalayed entry. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\delayedcourses */ - public function test_course_delayed() { + public function test_course_delayed(): void { $course = $this->getDataGenerator()->create_course(); @@ -111,7 +111,7 @@ public function test_course_delayed() { * Tests that a course is not excluded by this plugin, when there exists a dalayed entry, but it is expired. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\delayedcourses */ - public function test_course_delay_expired() { + public function test_course_delay_expired(): void { $course = $this->getDataGenerator()->create_course(); delayed_courses_manager::set_course_delayed($course->id, -2000); $recordset = $this->processor->get_course_recordset([$this->triggerinstance], []); @@ -129,7 +129,7 @@ public function test_course_delay_expired() { * Tests that a course is not excluded by this plugin, when it was delayed for a single workflow. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\delayedcourses */ - public function test_course_delay_for_single_workflow() { + public function test_course_delay_for_single_workflow(): void { $course = $this->getDataGenerator()->create_course(); delayed_courses_manager::set_course_delayed_for_workflow($course->id, true, $this->workflow->id); $recordset = $this->processor->get_course_recordset([$this->triggerinstance], []); @@ -147,7 +147,7 @@ public function test_course_delay_for_single_workflow() { * Tests that a course is excluded by this plugin, when it was delayed for all workflows. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\delayedcourses */ - public function test_course_delay_for_all_workflows() { + public function test_course_delay_for_all_workflows(): void { $course = $this->getDataGenerator()->create_course(); delayed_courses_manager::set_course_delayed_for_workflow($course->id, true, $this->workflowdealayingallworkflows->id); diff --git a/trigger/manual/classes/privacy/provider.php b/trigger/manual/classes/privacy/provider.php index b595b593..bbc660f9 100644 --- a/trigger/manual/classes/privacy/provider.php +++ b/trigger/manual/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/sitecourse/classes/privacy/provider.php b/trigger/sitecourse/classes/privacy/provider.php index 8ef22f4c..49601fc5 100644 --- a/trigger/sitecourse/classes/privacy/provider.php +++ b/trigger/sitecourse/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/sitecourse/tests/trigger_test.php b/trigger/sitecourse/tests/trigger_test.php index 2f48f48b..ea613e47 100644 --- a/trigger/sitecourse/tests/trigger_test.php +++ b/trigger/sitecourse/tests/trigger_test.php @@ -41,7 +41,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class trigger_test extends \advanced_testcase { +final class trigger_test extends \advanced_testcase { /** @var trigger_subplugin $triggerinstance Instance of the trigger. */ private $triggerinstance; @@ -50,7 +50,7 @@ class trigger_test extends \advanced_testcase { * Setup the testcase. * @throws coding_exception */ - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); @@ -61,7 +61,7 @@ public function setUp() : void { * Tests if the site course is excluded by this plugin. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\sitecourse */ - public function test_sitecourse_course() { + public function test_sitecourse_course(): void { $course = get_site(); @@ -75,7 +75,7 @@ public function test_sitecourse_course() { * Tests if courses, which are older than the default of 190 days are triggered by this plugin. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\sitecourse */ - public function test_normal_course() { + public function test_normal_course(): void { $course = $this->getDataGenerator()->create_course(); diff --git a/trigger/specificdate/classes/privacy/provider.php b/trigger/specificdate/classes/privacy/provider.php index 72e670ce..50e0b6f0 100644 --- a/trigger/specificdate/classes/privacy/provider.php +++ b/trigger/specificdate/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/startdatedelay/classes/privacy/provider.php b/trigger/startdatedelay/classes/privacy/provider.php index f994ae06..b5c52828 100644 --- a/trigger/startdatedelay/classes/privacy/provider.php +++ b/trigger/startdatedelay/classes/privacy/provider.php @@ -34,7 +34,7 @@ class provider implements null_provider { * * @return string the reason */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/trigger/startdatedelay/tests/trigger_test.php b/trigger/startdatedelay/tests/trigger_test.php index cae2a285..fe04e71c 100644 --- a/trigger/startdatedelay/tests/trigger_test.php +++ b/trigger/startdatedelay/tests/trigger_test.php @@ -40,7 +40,7 @@ * @copyright 2017 Tobias Reischmann WWU * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class trigger_test extends \advanced_testcase { +final class trigger_test extends \advanced_testcase { /** @var $triggerinstance trigger_subplugin Instance of the trigger. */ private $triggerinstance; @@ -48,7 +48,7 @@ class trigger_test extends \advanced_testcase { /** @var $processor processor Instance of the lifecycle processor. */ private $processor; - public function setUp() : void { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); @@ -60,7 +60,7 @@ public function setUp() : void { * Tests if courses, which are newer than the default of 190 days are not triggered by this plugin. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\startdatedelay */ - public function test_young_course() { + public function test_young_course(): void { $course = $this->getDataGenerator()->create_course(['startdate' => time() - 50 * 24 * 60 * 60]); @@ -79,7 +79,7 @@ public function test_young_course() { * Tests if courses, which are older than the default of 190 days are triggered by this plugin. * @covers \tool_lifecycle\processor \tool_lifecycle\trigger\startdatedelay */ - public function test_old_course() { + public function test_old_course(): void { $course = $this->getDataGenerator()->create_course(['startdate' => time() - 200 * 24 * 60 * 60]);