2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 // phpcs:disable moodle.PHPUnit.TestCaseNames.Missing
21 * Just a wrapper to access protected apis for testing.
23 * Note: This is deprecated. Please use Reflection instead.
27 * @copyright 2009 Petr Skoda {@link http://skodak.org}
28 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30 class test_exernal_api
extends \core_external\external_api
{
31 public static function get_context_wrapper($params) {
33 'test_exernal_api::get_context_wrapper() is deprecated. Please use Reflection instead.',
36 return self
::get_context_from_params($params);
41 * Test external API functions.
46 class core_externallib_test
extends \advanced_testcase
{
48 * Test the get_context_wrapper helper.
50 * @covers \core\test_exernal_api::get_context_wrapper
52 public function test_get_context_wrapper(): void
{
54 \context_system
::instance(),
55 \core\test_exernal_api
::get_context_wrapper(['contextid' => \context_system
::instance()->id
])
57 $this->assertDebuggingCalled(
58 'test_exernal_api::get_context_wrapper() is deprecated. Please use Reflection instead.'