diff --git a/tests/base_testcase.php b/tests/base_testcase.php index cc79c0d..1976ad2 100644 --- a/tests/base_testcase.php +++ b/tests/base_testcase.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace auth_outage; - use auth_outage\dml\outagedb; use auth_outage\local\outage; diff --git a/tests/calendar/calendar_test.php b/tests/calendar_test.php similarity index 99% rename from tests/calendar/calendar_test.php rename to tests/calendar_test.php index bc55123..74afa73 100644 --- a/tests/calendar/calendar_test.php +++ b/tests/calendar_test.php @@ -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. diff --git a/tests/local/cli/create_test.php b/tests/cli_create_test.php similarity index 98% rename from tests/local/cli/create_test.php rename to tests/cli_create_test.php index ec5b548..aefeff4 100644 --- a/tests/local/cli/create_test.php +++ b/tests/cli_create_test.php @@ -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. */ diff --git a/tests/local/cli/finish_test.php b/tests/cli_finish_test.php similarity index 96% rename from tests/local/cli/finish_test.php rename to tests/cli_finish_test.php index 163a28b..e872d85 100644 --- a/tests/local/cli/finish_test.php +++ b/tests/cli_finish_test.php @@ -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. */ diff --git a/tests/local/cli/cli_test.php b/tests/cli_test.php similarity index 95% rename from tests/local/cli/cli_test.php rename to tests/cli_test.php index 87b172d..d821e74 100644 --- a/tests/local/cli/cli_test.php +++ b/tests/cli_test.php @@ -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. */ diff --git a/tests/local/cli/cli_testcase.php b/tests/cli_testcase.php similarity index 92% rename from tests/local/cli/cli_testcase.php rename to tests/cli_testcase.php index b39a601..c449293 100644 --- a/tests/local/cli/cli_testcase.php +++ b/tests/cli_testcase.php @@ -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(); diff --git a/tests/local/cli/waitforit_test.php b/tests/cli_waitforit_test.php similarity index 97% rename from tests/local/cli/waitforit_test.php rename to tests/cli_waitforit_test.php index db596e9..fd9c354 100644 --- a/tests/local/cli/waitforit_test.php +++ b/tests/cli_waitforit_test.php @@ -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. */ diff --git a/tests/local/controllers/infopage_test.php b/tests/controllers_infopage_test.php similarity index 96% rename from tests/local/controllers/infopage_test.php rename to tests/controllers_infopage_test.php index 3cd582d..d78e6ce 100644 --- a/tests/local/controllers/infopage_test.php +++ b/tests/controllers_infopage_test.php @@ -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. */ diff --git a/tests/local/controllers/maintenance_static_page_test.php b/tests/controllers_maintenance_static_page_test.php similarity index 97% rename from tests/local/controllers/maintenance_static_page_test.php rename to tests/controllers_maintenance_static_page_test.php index 29f79df..3c142f8 100644 --- a/tests/local/controllers/maintenance_static_page_test.php +++ b/tests/controllers_maintenance_static_page_test.php @@ -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); } /** diff --git a/tests/dml/events_test.php b/tests/dml_events_test.php similarity index 98% rename from tests/dml/events_test.php rename to tests/dml_events_test.php index c9f66df..f810353 100644 --- a/tests/dml/events_test.php +++ b/tests/dml_events_test.php @@ -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. */ diff --git a/tests/dml/installation_test.php b/tests/dml_installation_test.php similarity index 94% rename from tests/dml/installation_test.php rename to tests/dml_installation_test.php index bd28a40..2f0b02e 100644 --- a/tests/dml/installation_test.php +++ b/tests/dml_installation_test.php @@ -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. * diff --git a/tests/dml/outagedb_test.php b/tests/dml_outagedb_test.php similarity index 98% rename from tests/dml/outagedb_test.php rename to tests/dml_outagedb_test.php index 07b4a01..55dea89 100644 --- a/tests/dml/outagedb_test.php +++ b/tests/dml_outagedb_test.php @@ -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. diff --git a/tests/local/controllers/fixtures/catalyst.png b/tests/fixtures/catalyst.png similarity index 100% rename from tests/local/controllers/fixtures/catalyst.png rename to tests/fixtures/catalyst.png diff --git a/tests/local/controllers/fixtures/simple.css b/tests/fixtures/simple.css similarity index 100% rename from tests/local/controllers/fixtures/simple.css rename to tests/fixtures/simple.css diff --git a/tests/local/controllers/fixtures/subdir/withurls-subdir.css b/tests/fixtures/subdir/withurls-subdir.css similarity index 100% rename from tests/local/controllers/fixtures/subdir/withurls-subdir.css rename to tests/fixtures/subdir/withurls-subdir.css diff --git a/tests/local/controllers/fixtures/withurls-quoted.css b/tests/fixtures/withurls-quoted.css similarity index 100% rename from tests/local/controllers/fixtures/withurls-quoted.css rename to tests/fixtures/withurls-quoted.css diff --git a/tests/local/controllers/fixtures/withurls.css b/tests/fixtures/withurls.css similarity index 100% rename from tests/local/controllers/fixtures/withurls.css rename to tests/fixtures/withurls.css diff --git a/tests/form/outage/forms_test.php b/tests/forms_test.php similarity index 96% rename from tests/form/outage/forms_test.php rename to tests/forms_test.php index 0f28f55..de5c569 100644 --- a/tests/form/outage/forms_test.php +++ b/tests/forms_test.php @@ -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. */ diff --git a/tests/lib_test.php b/tests/lib_test.php index ec53cbe..286f34c 100644 --- a/tests/lib_test.php +++ b/tests/lib_test.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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. */ diff --git a/tests/local/outage_test.php b/tests/outage_test.php similarity index 98% rename from tests/local/outage_test.php rename to tests/outage_test.php index 4bf5831..9c06b6d 100644 --- a/tests/local/outage_test.php +++ b/tests/outage_test.php @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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. */ diff --git a/tests/local/outagelib_test.php b/tests/outagelib_test.php similarity index 99% rename from tests/local/outagelib_test.php rename to tests/outagelib_test.php index 73b536b..e41efa0 100644 --- a/tests/local/outagelib_test.php +++ b/tests/outagelib_test.php @@ -14,14 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -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. */