Skip to content

Commit

Permalink
MDL-73728 admin: Move adminpresets to admin/presets
Browse files Browse the repository at this point in the history
This commit moves the presets subsystem to a location within the admin
folder, which is more appropriate given its purpose and reduces
developer frustration with tab completion of the admin directory.
  • Loading branch information
andrewnicols committed Feb 3, 2022
1 parent c352b70 commit fc082d3
Show file tree
Hide file tree
Showing 48 changed files with 13 additions and 13 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions admin/tool/admin_presets/tests/behat/import_file.feature
Expand Up @@ -10,7 +10,7 @@ Feature: I can upload a preset file
Given I should see "Import site admin preset"
And I click on "Import" "button"
And I should see "You must supply a value here"
And I upload "adminpresets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
And I upload "admin/presets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
And I click on "Import" "button"
And I should see "Setting changes"
And I should see "Imported preset"
Expand All @@ -31,7 +31,7 @@ Feature: I can upload a preset file
Scenario: Rename imported settings
Given I should see "Import site admin preset"
And I set the field "Name" to "Renamed preset"
And I upload "adminpresets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
And I upload "admin/presets/tests/fixtures/import_settings_plugins.xml" file to "Select file" filemanager
And I click on "Import" "button"
And I should not see "Imported preset"
And I should see "Renamed preset"
Expand All @@ -42,7 +42,7 @@ Feature: I can upload a preset file

Scenario: Import settings from an invalid XML file
Given I set the field "Name" to "Renamed preset"
And I upload "adminpresets/tests/fixtures/invalid_xml_file.xml" file to "Select file" filemanager
And I upload "admin/presets/tests/fixtures/invalid_xml_file.xml" file to "Select file" filemanager
When I click on "Import" "button"
Then I should see "Wrong file"
And I should not see "Setting changes"
Expand All @@ -51,7 +51,7 @@ Feature: I can upload a preset file

Scenario: Import unexisting settings category
Given I set the field "Name" to "Renamed preset"
And I upload "adminpresets/tests/fixtures/unexisting_category.xml" file to "Select file" filemanager
And I upload "admin/presets/tests/fixtures/unexisting_category.xml" file to "Select file" filemanager
When I click on "Import" "button"
Then I should see "No valid settings"
And I should not see "Setting changes"
Expand All @@ -63,7 +63,7 @@ Feature: I can upload a preset file
| debug | 0 |
| debugdisplay | 0 |
And I set the field "Name" to "Renamed preset"
And I upload "adminpresets/tests/fixtures/import_settings_with_unexisting_setting.xml" file to "Select file" filemanager
And I upload "admin/presets/tests/fixtures/import_settings_with_unexisting_setting.xml" file to "Select file" filemanager
When I click on "Import" "button"
And I should see "Setting changes"
And I should see "Enable portfolios" in the "core" "table_row"
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/tests/generator/lib.php
Expand Up @@ -17,7 +17,7 @@
defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once($CFG->dirroot . '/adminpresets/tests/generator/lib.php');
require_once($CFG->dirroot . '/admin/presets/tests/generator/lib.php');

/**
* Data generator the admin_presets tool.
Expand Down
Expand Up @@ -189,7 +189,7 @@ public function test_import_execute(string $filecontents, bool $expectedpreset,
* @return array
*/
public function import_execute_provider(): array {
$fixturesfolder = __DIR__ . '/../../../../../../adminpresets/tests/fixtures/';
$fixturesfolder = __DIR__ . '/../../../../../presets/tests/fixtures/';

return [
'Import settings from an empty file' => [
Expand Down
2 changes: 1 addition & 1 deletion config-dist.php
Expand Up @@ -1163,7 +1163,7 @@
// This setting accepts the following values:
// - One of the core preset names (i.e "starter" or "full").
// - The path of a valid XML preset file, that will be imported and applied. Absolute paths are recommended, to
// guarantee the file is found: i.e."MOODLEPATH/adminpresets/tests/fixtures/import_settings_plugins.xml".
// guarantee the file is found: i.e."MOODLEPATH/admin/presets/tests/fixtures/import_settings_plugins.xml".
//
// This setting is only used during the installation process. So once the Moodle site is installed, it is ignored.
//
Expand Down
2 changes: 1 addition & 1 deletion lib/components.json
Expand Up @@ -45,7 +45,7 @@
"subsystems": {
"access": null,
"admin": "admin",
"adminpresets": "adminpresets",
"adminpresets": "admin/presets",
"analytics": "analytics",
"antivirus": "lib\/antivirus",
"auth": "auth",
Expand Down
2 changes: 1 addition & 1 deletion lib/db/install.php
Expand Up @@ -333,6 +333,6 @@ function xmldb_main_install() {
badges_install_default_backpacks();

// Create default core site admin presets.
require_once($CFG->dirroot . '/adminpresets/classes/helper.php');
require_once($CFG->dirroot . '/admin/presets/classes/helper.php');
\core_adminpresets\helper::create_default_presets();
}
2 changes: 1 addition & 1 deletion lib/db/upgrade.php
Expand Up @@ -3508,7 +3508,7 @@ function xmldb_main_upgrade($oldversion) {

if ($DB->count_records('adminpresets', ['iscore' => 1]) == 0) {
// Create default core site admin presets.
require_once($CFG->dirroot . '/adminpresets/classes/helper.php');
require_once($CFG->dirroot . '/admin/presets/classes/helper.php');
\core_adminpresets\helper::create_default_presets();
}

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -209,7 +209,7 @@
<directory suffix="_test.php">reportbuilder/tests</directory>
</testsuite>
<testsuite name="core_adminpresets_testsuite">
<directory suffix="_test.php">adminpresets/tests</directory>
<directory suffix="_test.php">admin/presets/tests</directory>
</testsuite>

<!--Plugin suites: use admin/tool/phpunit/cli/util.php to build phpunit.xml from
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

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

$version = 2022020200.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2022020201.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev+ (Build: 20220202)'; // Human-friendly version name
Expand Down

0 comments on commit fc082d3

Please sign in to comment.