Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 25... Línea 25...
25
 * Unit tests for plugin base class.
25
 * Unit tests for plugin base class.
26
 *
26
 *
27
 * @package   core
27
 * @package   core
28
 * @copyright 2019 Andrew Nicols
28
 * @copyright 2019 Andrew Nicols
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
30
 * @covers \core\plugininfo\base
30
 */
31
 */
31
class base_test extends \advanced_testcase {
32
final class base_test extends \advanced_testcase {
Línea 32... Línea 33...
32
 
33
 
33
    /**
34
    /**
34
     * Setup to ensure that fixtures are loaded.
35
     * Setup to ensure that fixtures are loaded.
35
     */
36
     */
36
    public static function setUpBeforeClass(): void {
37
    public static function setUpBeforeClass(): void {
Línea 37... Línea 38...
37
        global $CFG;
38
        global $CFG;
38
 
39
 
-
 
40
        require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugin_manager.php');
39
        require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugin_manager.php');
41
        require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugininfo_base.php');
Línea 40... Línea 42...
40
        require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugininfo_base.php');
42
        parent::setUpBeforeClass();
41
    }
43
    }
42
 
44
 
43
    /**
45
    /**
44
     * Tear down the testable plugin manager singleton between tests.
46
     * Tear down the testable plugin manager singleton between tests.
45
     */
47
     */
46
    public function tearDown(): void {
48
    public function tearDown(): void {
-
 
49
        // The caches of the testable singleton must be reset explicitly. It is
47
        // The caches of the testable singleton must be reset explicitly. It is
50
        // safer to kill the whole testable singleton at the end of every test.
Línea 48... Línea 51...
48
        // safer to kill the whole testable singleton at the end of every test.
51
        testable_core_plugin_manager::reset_caches();
49
        testable_core_plugin_manager::reset_caches();
52
        parent::tearDown();
50
    }
53
    }
Línea 81... Línea 84...
81
    /**
84
    /**
82
     * Data provider for the load_disk_version tests for testing with invalid supported fields.
85
     * Data provider for the load_disk_version tests for testing with invalid supported fields.
83
     *
86
     *
84
     * @return array
87
     * @return array
85
     */
88
     */
86
    public function load_disk_version_invalid_supported_version_provider(): array {
89
    public static function load_disk_version_invalid_supported_version_provider(): array {
87
        return [
90
        return [
88
            'Invalid supported range.' => [
91
            'Invalid supported range.' => [
89
                'supported' => [31, 29],
92
                'supported' => [31, 29],
90
                'incompatible' => null,
93
                'incompatible' => null,
91
                'version' => 32,
94
                'version' => 32,
Línea 147... Línea 150...
147
    /**
150
    /**
148
     * Data provider for the load_disk_version tests for testing with invalid incompatible fields.
151
     * Data provider for the load_disk_version tests for testing with invalid incompatible fields.
149
     *
152
     *
150
     * @return array
153
     * @return array
151
     */
154
     */
152
    public function load_disk_version_invalid_incompatible_version_provider(): array {
155
    public static function load_disk_version_invalid_incompatible_version_provider(): array {
153
        return [
156
        return [
154
            [[38]],
157
            [[38]],
155
            [['38']],
158
            [['38']],
156
            [3.8],
159
            [3.8],
157
            ['3.8'],
160
            ['3.8'],
Línea 195... Línea 198...
195
    /**
198
    /**
196
     * Test cases for tests of load_disk_version for testing the supported/incompatible fields.
199
     * Test cases for tests of load_disk_version for testing the supported/incompatible fields.
197
     *
200
     *
198
     * @return array
201
     * @return array
199
     */
202
     */
200
    public function load_disk_version_branch_supports_provider(): array {
203
    public static function load_disk_version_branch_supports_provider(): array {
201
        return [
204
        return [
202
            'Range, branch in support, lowest' => [
205
            'Range, branch in support, lowest' => [
203
                'supported' => [29, 31],
206
                'supported' => [29, 31],
204
                'incompatible' => null,
207
                'incompatible' => null,
205
                'version' => 29,
208
                'version' => 29,
Línea 273... Línea 276...
273
        ];
276
        ];
274
    }
277
    }
Línea 275... Línea 278...
275
 
278
 
276
    /**
279
    /**
277
     * Ensure that plugintype_supports_ordering() returns true.
-
 
278
     * @covers ::plugintype_supports_ordering
280
     * Ensure that plugintype_supports_ordering() returns true.
279
     */
281
     */
280
    public function test_plugintype_supports_ordering(): void {
282
    public function test_plugintype_supports_ordering(): void {
281
        $this->assertFalse(base::plugintype_supports_ordering());
283
        $this->assertFalse(base::plugintype_supports_ordering());
Línea 309... Línea 311...
309
    /**
311
    /**
310
     * Data provider for plugins_not_supporting_ordering.
312
     * Data provider for plugins_not_supporting_ordering.
311
     *
313
     *
312
     * @return string[]
314
     * @return string[]
313
     */
315
     */
314
    public function plugins_not_supporting_ordering(): array {
316
    public static function plugins_not_supporting_ordering(): array {
315
        return [
317
        return [
316
            ['mod_assign'],
318
            ['mod_assign'],
317
            ['block_login'],
319
            ['block_login'],
318
        ];
320
        ];
319
    }
321
    }