MDL-75777 phpunit: Move tests to use correct names and ns (take#6)

Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.
This commit is contained in:
Eloy Lafuente (stronk7)
2022-09-19 11:02:50 +02:00
parent 844abeaf5d
commit be02cc3687
49 changed files with 636 additions and 722 deletions
+8 -13
View File
@@ -14,29 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains tests for the {@link question_utils} class.
*
* @package moodlecore
* @subpackage questionengine
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_question;
use question_utils;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once(__DIR__ . '/../lib.php');
/**
* Unit tests for the {@link question_utils} class.
*
* @package core_question
* @category test
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class question_utils_test extends advanced_testcase {
class questionutils_test extends \advanced_testcase {
public function test_arrays_have_same_keys_and_values() {
$this->assertTrue(question_utils::arrays_have_same_keys_and_values(
array(),
@@ -207,17 +202,17 @@ class question_utils_test extends advanced_testcase {
}
public function test_int_to_roman_too_small() {
$this->expectException(moodle_exception::class);
$this->expectException(\moodle_exception::class);
question_utils::int_to_roman(0);
}
public function test_int_to_roman_too_big() {
$this->expectException(moodle_exception::class);
$this->expectException(\moodle_exception::class);
question_utils::int_to_roman(4000);
}
public function test_int_to_roman_not_int() {
$this->expectException(moodle_exception::class);
$this->expectException(\moodle_exception::class);
question_utils::int_to_roman(1.5);
}