Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 41... Línea 41...
41
 * @package   core_completion
41
 * @package   core_completion
42
 * @copyright 2021 Jun Pataleta <jun@moodle.com>
42
 * @copyright 2021 Jun Pataleta <jun@moodle.com>
43
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
44
 * @coversDefaultClass \core_completion\cm_completion_details
44
 * @coversDefaultClass \core_completion\cm_completion_details
45
 */
45
 */
46
class cm_completion_details_test extends advanced_testcase {
46
final class cm_completion_details_test extends advanced_testcase {
Línea 47... Línea 47...
47
 
47
 
48
    /** @var completion_info A completion object. */
48
    /** @var completion_info A completion object. */
Línea 49... Línea 49...
49
    protected $completioninfo = null;
49
    protected $completioninfo = null;
Línea 56... Línea 56...
56
     * @param object $mockcompletiondata Mock data to be returned by get_data.
56
     * @param object $mockcompletiondata Mock data to be returned by get_data.
57
     * @param string $modname The modname to set in the cm if a specific one is required.
57
     * @param string $modname The modname to set in the cm if a specific one is required.
58
     * @return cm_completion_details
58
     * @return cm_completion_details
59
     */
59
     */
60
    protected function setup_data(?int $completion, array $completionoptions = [],
60
    protected function setup_data(?int $completion, array $completionoptions = [],
61
            object $mockcompletiondata = null, $modname = 'somenonexistentmod'): cm_completion_details {
61
            ?object $mockcompletiondata = null, $modname = 'somenonexistentmod'): cm_completion_details {
62
        if (is_null($completion)) {
62
        if (is_null($completion)) {
63
            $completion = COMPLETION_TRACKING_AUTOMATIC;
63
            $completion = COMPLETION_TRACKING_AUTOMATIC;
64
        }
64
        }
Línea 65... Línea 65...
65
 
65
 
Línea 103... Línea 103...
103
    /**
103
    /**
104
     * Provides data for test_has_completion().
104
     * Provides data for test_has_completion().
105
     *
105
     *
106
     * @return array[]
106
     * @return array[]
107
     */
107
     */
108
    public function has_completion_provider(): array {
108
    public static function has_completion_provider(): array {
109
        return [
109
        return [
110
            'Automatic' => [
110
            'Automatic' => [
111
                COMPLETION_TRACKING_AUTOMATIC, true
111
                COMPLETION_TRACKING_AUTOMATIC, true
112
            ],
112
            ],
113
            'Manual' => [
113
            'Manual' => [
Línea 136... Línea 136...
136
    /**
136
    /**
137
     * Provides data for test_is_automatic().
137
     * Provides data for test_is_automatic().
138
     *
138
     *
139
     * @return array[]
139
     * @return array[]
140
     */
140
     */
141
    public function is_automatic_provider(): array {
141
    public static function is_automatic_provider(): array {
142
        return [
142
        return [
143
            'Automatic' => [
143
            'Automatic' => [
144
                COMPLETION_TRACKING_AUTOMATIC, true
144
                COMPLETION_TRACKING_AUTOMATIC, true
145
            ],
145
            ],
146
            'Manual' => [
146
            'Manual' => [
Línea 169... Línea 169...
169
    /**
169
    /**
170
     * Provides data for test_is_manual().
170
     * Provides data for test_is_manual().
171
     *
171
     *
172
     * @return array[]
172
     * @return array[]
173
     */
173
     */
174
    public function is_manual_provider(): array {
174
    public static function is_manual_provider(): array {
175
        return [
175
        return [
176
            'Automatic' => [
176
            'Automatic' => [
177
                COMPLETION_TRACKING_AUTOMATIC, false
177
                COMPLETION_TRACKING_AUTOMATIC, false
178
            ],
178
            ],
179
            'Manual' => [
179
            'Manual' => [
Línea 201... Línea 201...
201
 
201
 
202
    /**
202
    /**
203
     * Data provider for test_get_overall_completion().
203
     * Data provider for test_get_overall_completion().
204
     * @return array[]
204
     * @return array[]
205
     */
205
     */
206
    public function overall_completion_provider(): array {
206
    public static function overall_completion_provider(): array {
207
        return [
207
        return [
208
            'Complete' => [COMPLETION_COMPLETE],
208
            'Complete' => [COMPLETION_COMPLETE],
209
            'Incomplete' => [COMPLETION_INCOMPLETE],
209
            'Incomplete' => [COMPLETION_INCOMPLETE],
210
        ];
210
        ];
Línea 360... Línea 360...
360
 
360
 
361
    /**
361
    /**
362
     * Data provider for test_get_details().
362
     * Data provider for test_get_details().
363
     * @return array[]
363
     * @return array[]
364
     */
364
     */
365
    public function get_details_provider() {
365
    public static function get_details_provider(): array {
366
        return [
366
        return [
367
            'No completion tracking' => [
367
            'No completion tracking' => [
368
                COMPLETION_TRACKING_NONE, null, null, null, []
368
                COMPLETION_TRACKING_NONE, null, null, null, []
369
            ],
369
            ],
Línea 521... Línea 521...
521
 
521
 
522
    /**
522
    /**
523
     * Data provider for test_get_details_custom_order().
523
     * Data provider for test_get_details_custom_order().
524
     * @return array[]
524
     * @return array[]
525
     */
525
     */
526
    public function get_details_custom_order_provider() {
526
    public static function get_details_custom_order_provider(): array {
527
        return [
527
        return [
528
            'Custom and view/grade standard conditions, view first and grade last' => [
528
            'Custom and view/grade standard conditions, view first and grade last' => [
529
                true,
529
                true,
530
                true,
530
                true,