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
 * @category   test
25
 * @category   test
26
 * @copyright  2021 Sara Arjona (sara@moodle.com)
26
 * @copyright  2021 Sara Arjona (sara@moodle.com)
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 * @coversDefaultClass \core_courseformat\stateupdates
28
 * @coversDefaultClass \core_courseformat\stateupdates
29
 */
29
 */
30
class stateupdates_test extends \advanced_testcase {
30
final class stateupdates_test extends \advanced_testcase {
Línea 31... Línea 31...
31
 
31
 
32
    /**
32
    /**
33
     * Test for add_course_put.
33
     * Test for add_course_put.
34
     *
34
     *
Línea 79... Línea 79...
79
    /**
79
    /**
80
     * Data provider for test_add_course_put.
80
     * Data provider for test_add_course_put.
81
     *
81
     *
82
     * @return array testing scenarios
82
     * @return array testing scenarios
83
     */
83
     */
84
    public function add_course_put_provider() {
84
    public static function add_course_put_provider(): array {
85
        return [
85
        return [
86
            'Admin role' => [
86
            'Admin role' => [
87
                'admin',
87
                'admin',
88
            ],
88
            ],
89
            'Teacher role' => [
89
            'Teacher role' => [
Línea 197... Línea 197...
197
    /**
197
    /**
198
     * Data provider for test_add_section.
198
     * Data provider for test_add_section.
199
     *
199
     *
200
     * @return array testing scenarios
200
     * @return array testing scenarios
201
     */
201
     */
202
    public function add_section_provider(): array {
202
    public static function add_section_provider(): array {
203
        return array_merge(
203
        return array_merge(
204
            $this->add_section_provider_helper('put'),
204
            self::add_section_provider_helper('put'),
205
            $this->add_section_provider_helper('create'),
205
            self::add_section_provider_helper('create'),
206
            $this->add_section_provider_helper('remove'),
206
            self::add_section_provider_helper('remove'),
207
        );
207
        );
208
    }
208
    }
Línea 209... Línea 209...
209
 
209
 
210
    /**
210
    /**
211
     * Helper for add_section_provider scenarios.
211
     * Helper for add_section_provider scenarios.
212
     *
212
     *
213
     * @param string $action the action to perform
213
     * @param string $action the action to perform
214
     * @return array testing scenarios
214
     * @return array testing scenarios
215
     */
215
     */
216
    private function add_section_provider_helper(string $action): array {
216
    private static function add_section_provider_helper(string $action): array {
217
        // Delete does not depends on user permissions.
217
        // Delete does not depends on user permissions.
218
        if ($action == 'remove') {
218
        if ($action == 'remove') {
219
            $studentsections = [0, 1, 2];
219
            $studentsections = [0, 1, 2];
220
        } else {
220
        } else {
Línea 341... Línea 341...
341
    /**
341
    /**
342
     * Data provider for test_add_cm.
342
     * Data provider for test_add_cm.
343
     *
343
     *
344
     * @return array testing scenarios
344
     * @return array testing scenarios
345
     */
345
     */
346
    public function add_cm_provider(): array {
346
    public static function add_cm_provider(): array {
347
        return array_merge(
347
        return array_merge(
348
            $this->add_cm_provider_helper('put'),
348
            self::add_cm_provider_helper('put'),
349
            $this->add_cm_provider_helper('create'),
349
            self::add_cm_provider_helper('create'),
350
            $this->add_cm_provider_helper('remove'),
350
            self::add_cm_provider_helper('remove'),
351
        );
351
        );
352
    }
352
    }
Línea 353... Línea 353...
353
 
353
 
354
    /**
354
    /**
355
     * Helper for add_cm_provider scenarios.
355
     * Helper for add_cm_provider scenarios.
356
     *
356
     *
357
     * @param string $action the action to perform
357
     * @param string $action the action to perform
358
     * @return array testing scenarios
358
     * @return array testing scenarios
359
     */
359
     */
360
    private function add_cm_provider_helper(string $action): array {
360
    private static function add_cm_provider_helper(string $action): array {
361
        // Delete does not depends on user permissions.
361
        // Delete does not depends on user permissions.
362
        if ($action == 'remove') {
362
        if ($action == 'remove') {
363
            $studentcms = [0, 1, 2, 3];
363
            $studentcms = [0, 1, 2, 3];
364
        } else {
364
        } else {