forked from moodlehq/moodle-plugin-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New tests towards better cov in some classes with low metrics
- MoodlePluginCI\Bridge\Moodle : 21% => 100%
- Loading branch information
Showing
4 changed files
with
188 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Moodle Plugin CI package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com} | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
/** | ||
* Minimal core_component core class. | ||
* | ||
* This is a minimal fixture of the Moodle core_component class, just to be able | ||
* to use it in the tests, only including the methods that we are going to need to | ||
* invoke. | ||
* Note that we haven't been able to use Mockery for this, because the code to be | ||
* tested is using Reflection on this class, so we cannot use aliases/overload or | ||
* similar strategirs to mock it. | ||
*/ | ||
class core_component { | ||
|
||
public static function get_component_directory($component) { | ||
return '/path/to/' . str_replace('_', '/', $component); | ||
} | ||
|
||
public static function normalize_component($component) { | ||
return explode('_', $component, 2); | ||
} | ||
|
||
protected static function fetch_plugintypes() { | ||
return [ | ||
['mod' => '/path/to/mod', 'local' => '/path/to/local'], | ||
[], // We don't need this. | ||
[], // We don't need this. | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php // Moodle configuration file | ||
|
||
unset($CFG); | ||
global $CFG; | ||
$CFG = new stdClass(); | ||
|
||
$CFG->dbtype = 'mysqli'; | ||
$CFG->dblibrary = 'native'; | ||
$CFG->dbhost = 'localhost'; | ||
$CFG->dbname = 'moodle'; | ||
$CFG->dbuser = 'root'; | ||
$CFG->dbpass = ''; | ||
$CFG->prefix = 'mdl_'; | ||
$CFG->dboptions = [ | ||
'dbport' => '', | ||
]; | ||
|
||
$CFG->wwwroot = 'http://localhost/moodle'; | ||
$CFG->dataroot = '/path/to/moodledata'; | ||
$CFG->admin = 'admin'; | ||
|
||
$CFG->directorypermissions = 02777; | ||
|
||
// Show debugging messages. | ||
$CFG->debug = (E_ALL | E_STRICT); | ||
$CFG->debugdisplay = 1; | ||
|
||
// Extra config. | ||
$CFG->exists = 'exists'; | ||
|
||
// require_once(__DIR__.'/lib/setup.php'); | ||
// There is no php closing tag in this file, | ||
// it is intentional because it prevents trailing whitespace problems! |