Merge pull request #370 from SashaAnastasi/TOTARA_19-t19_fixes

[T19] Fixes for totara19
This commit is contained in:
Dan Marsden
2025-02-27 14:27:17 +13:00
committed by GitHub
21 changed files with 107 additions and 55 deletions

View File

@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_outage;
use auth_outage\dml\outagedb;
use auth_outage\local\outage;

View File

@@ -23,9 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\calendar;
use auth_outage\local\outage;
use auth_outage\calendar\calendar;
/**
* calendar_test test class.

View File

@@ -23,10 +23,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
use auth_outage\local\outage;
use auth_outage\local\cli\create;
use auth_outage\local\cli\cli_exception;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/cli_testcase.php');
@@ -40,7 +40,12 @@ require_once(__DIR__.'/cli_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\cli\create
*/
class create_test extends cli_testcase {
class cli_create_test extends cli_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests without any arguments.
*/

View File

@@ -23,10 +23,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
use auth_outage\local\outage;
use auth_outage\local\cli\finish;
use auth_outage\local\cli\cli_exception;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/cli_testcase.php');
@@ -40,7 +40,12 @@ require_once(__DIR__.'/cli_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\cli\finish
*/
class finish_test extends cli_testcase {
class cli_finish_test extends cli_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests the constructor.
*/

View File

@@ -23,7 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\local\cli\cli_exception;
use auth_outage\local\cli\create;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/cli_testcase.php');
@@ -38,6 +39,11 @@ require_once(__DIR__.'/cli_testcase.php');
* @covers \auth_outage\local\cli\create
*/
class cli_test extends cli_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests providing an unknown parameter.
*/

View File

@@ -23,10 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* cli_testcase class.
@@ -36,7 +34,12 @@ require_once(__DIR__.'/../../base_testcase.php');
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class cli_testcase extends \auth_outage\base_testcase {
abstract class cli_testcase extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Always enable the auth outage plugin, resets after test and set no parameters.
*/
@@ -73,7 +76,7 @@ abstract class cli_testcase extends \auth_outage\base_testcase {
*
* @return string The output text.
*/
protected function execute(clibase $cli) {
protected function execute(mixed $cli) {
ob_start();
try {
$cli->execute();

View File

@@ -23,10 +23,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\cli;
use auth_outage\dml\outagedb;
use auth_outage\local\outage;
use auth_outage\local\cli\waitforit;
use auth_outage\local\cli\cli_exception;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/cli_testcase.php');
@@ -40,7 +40,12 @@ require_once(__DIR__.'/cli_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\cli\waitforit
*/
class waitforit_test extends cli_testcase {
class cli_waitforit_test extends cli_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests the constructor.
*/

View File

@@ -23,13 +23,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\controllers;
use auth_outage\local\outage;
use auth_outage\local\controllers\infopage;
use context_system;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* Tests performed on infopage controller class and update_static_page task class.
@@ -40,7 +39,12 @@ require_once(__DIR__.'/../../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\controllers\infopage
*/
class infopage_test extends \auth_outage\base_testcase {
class controllers_infopage_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests the constructor.
*/

View File

@@ -23,13 +23,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\local\controllers;
use auth_outage\task\update_static_page;
use auth_outage\local\controllers\maintenance_static_page;
use auth_outage\local\controllers\maintenance_static_page_io;
use auth_outage\local\controllers\maintenance_static_page_generator;
use DOMDocument;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* maintenance_static_page_test class.
@@ -40,7 +41,12 @@ require_once(__DIR__.'/../../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\controllers\maintenance_static_page_generator
*/
class maintenance_static_page_test extends \auth_outage\base_testcase {
class controllers_maintenance_static_page_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Test template file.
*/
@@ -122,7 +128,7 @@ class maintenance_static_page_test extends \auth_outage\base_testcase {
$page->generate();
// Check for css file.
self::assertFileExists($page->get_io()->get_resources_folder().'/53365950336b070c0b26ca50e7d0dad962c364e6.dGV4dC9wbGFpbg');
self::assertFileExists($page->get_io()->get_resources_folder().'/b09bd4b66cc3964d5fc5978752fc554f5666daa3.dGV4dC9wbGFpbg');
// Check for catalyst.png file referenced in url(..) of css.
self::assertFileExists($page->get_io()->get_resources_folder().'/ff7f7f87a26a908fc72930eaefb6b57306361d16.aW1hZ2UvcG5n');
@@ -140,7 +146,7 @@ class maintenance_static_page_test extends \auth_outage\base_testcase {
$page->generate();
// Check for css file.
self::assertFileExists($page->get_io()->get_resources_folder().'/e0b34925c1f939c247a4b50d6bf08c76088def39.dGV4dC9wbGFpbg');
self::assertFileExists($page->get_io()->get_resources_folder().'/2ec04228cc8bb37782f511aaeb01ee553cc884a4.dGV4dC9wbGFpbg');
// Check for catalyst.png file referenced in url(..) of css.
self::assertFileExists($page->get_io()->get_resources_folder().'/ff7f7f87a26a908fc72930eaefb6b57306361d16.aW1hZ2UvcG5n');
@@ -338,7 +344,7 @@ class maintenance_static_page_test extends \auth_outage\base_testcase {
* @return string
*/
private function get_fixture_path_location($file) {
return (string)new \moodle_url('/auth/outage/tests/local/controllers/fixtures/'.$file);
return (string)new \moodle_url('/auth/outage/tests/fixtures/'.$file);
}
/**

View File

@@ -23,9 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\dml;
use auth_outage\local\outage;
use auth_outage\dml\outagedb;
/**
* events_test tests class.
@@ -39,7 +38,7 @@ use auth_outage\local\outage;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\dml\outagedb
*/
class events_test extends \core_phpunit\testcase {
class dml_events_test extends \core_phpunit\testcase {
/**
* @var outage|null Outage used in the tests.
*/

View File

@@ -25,12 +25,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\dml;
use auth_outage\local\outage;
use auth_outage\dml\outagedb;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* installation_test test class.
@@ -43,7 +42,12 @@ require_once(__DIR__.'/../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\dml\outagedb
*/
class installation_test extends \auth_outage\base_testcase {
class dml_installation_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Checks if plugin cleans up data after uninstall.
*

View File

@@ -23,12 +23,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\dml;
use auth_outage\local\outage;
use auth_outage\dml\outagedb;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* outagedb_test tests class.
@@ -39,7 +38,12 @@ require_once(__DIR__.'/../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\dml\outagedb
*/
class outagedb_test extends \auth_outage\base_testcase {
class dml_outagedb_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Creates an array of ids in from the given outages array.
* @param outage[] $outages An array of outages.

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -23,12 +23,13 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace auth_outage\form\outage;
use auth_outage\local\outage;
use auth_outage\form\outage\delete;
use auth_outage\form\outage\finish;
use auth_outage\form\outage\edit;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* forms_test test class.
@@ -39,7 +40,12 @@ require_once(__DIR__.'/../../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\form\outage\edit
*/
class forms_test extends \auth_outage\base_testcase {
class forms_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Create a delete form.
*/

View File

@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_outage;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/base_testcase.php');
require_once(__DIR__.'/../lib.php');
@@ -29,7 +27,7 @@ require_once(__DIR__.'/../lib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers ::auth_outage_get_climaintenance_resource_file
*/
class lib_test extends base_testcase {
class lib_test extends \core_phpunit\testcase {
/**
* Test this plugin gets climaintenance resource file.
*/

View File

@@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_outage\local;
use auth_outage\local\outage;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__.'/../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* outage_test test class.
@@ -28,7 +28,12 @@ require_once(__DIR__.'/../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\outage
*/
class outage_test extends \auth_outage\base_testcase {
class outage_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Tests the constructor.
*/

View File

@@ -14,14 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace auth_outage\local;
use auth_outage\dml\outagedb;
use auth_outage\local\outage;
use auth_outage\local\outagelib;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir.'/adminlib.php');
require_once(__DIR__.'/../base_testcase.php');
require_once(__DIR__.'/base_testcase.php');
/**
* outagelib_test test class.
@@ -32,7 +32,12 @@ require_once(__DIR__.'/../base_testcase.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\local\outagelib
*/
class outagelib_test extends \auth_outage\base_testcase {
class outagelib_test extends base_testcase {
public function tearDown(): void {
parent::tearDown();
}
/**
* Check if maintenance message is disabled as needed.
*/