MDL-49329 admin: Make core_plugin_manager better suited for unit testing
We can now override the plugin manager's methods in the testable subclass while still keeping the singleton behaviour of it. The change makes use of late static binding.
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Provides testable_core_plugin_manager class.
|
||||
*
|
||||
* @package core
|
||||
* @category test
|
||||
* @copyright 2015 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Testable variant of the core_plugin_manager
|
||||
*
|
||||
* @copyright 2015 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class testable_core_plugin_manager extends core_plugin_manager {
|
||||
|
||||
/** @var testable_core_plugin_manager holds the singleton instance */
|
||||
protected static $singletoninstance;
|
||||
}
|
||||
Reference in New Issue
Block a user