Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 68... Línea 68...
68
     * @param int $available Whether this rule is available.
68
     * @param int $available Whether this rule is available.
69
     * @param bool $submitted Whether the user has made a choice.
69
     * @param bool $submitted Whether the user has made a choice.
70
     * @param int|null $status Expected status.
70
     * @param int|null $status Expected status.
71
     * @param string|null $exception Expected exception.
71
     * @param string|null $exception Expected exception.
72
     */
72
     */
73
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception) {
73
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception): void {
74
        global $DB;
74
        global $DB;
Línea 75... Línea 75...
75
 
75
 
76
        if (!is_null($exception)) {
76
        if (!is_null($exception)) {
77
            $this->expectException($exception);
77
            $this->expectException($exception);
Línea 109... Línea 109...
109
    }
109
    }
Línea 110... Línea 110...
110
 
110
 
111
    /**
111
    /**
112
     * Test for get_defined_custom_rules().
112
     * Test for get_defined_custom_rules().
113
     */
113
     */
114
    public function test_get_defined_custom_rules() {
114
    public function test_get_defined_custom_rules(): void {
115
        $rules = custom_completion::get_defined_custom_rules();
115
        $rules = custom_completion::get_defined_custom_rules();
116
        $this->assertCount(1, $rules);
116
        $this->assertCount(1, $rules);
117
        $this->assertEquals('completionsubmit', reset($rules));
117
        $this->assertEquals('completionsubmit', reset($rules));
Línea 118... Línea 118...
118
    }
118
    }
119
 
119
 
120
    /**
120
    /**
121
     * Test for get_defined_custom_rule_descriptions().
121
     * Test for get_defined_custom_rule_descriptions().
122
     */
122
     */
123
    public function test_get_custom_rule_descriptions() {
123
    public function test_get_custom_rule_descriptions(): void {
Línea 124... Línea 124...
124
        // Get defined custom rules.
124
        // Get defined custom rules.
125
        $rules = custom_completion::get_defined_custom_rules();
125
        $rules = custom_completion::get_defined_custom_rules();
Línea 144... Línea 144...
144
    }
144
    }
Línea 145... Línea 145...
145
 
145
 
146
    /**
146
    /**
147
     * Test for is_defined().
147
     * Test for is_defined().
148
     */
148
     */
149
    public function test_is_defined() {
149
    public function test_is_defined(): void {
150
        // Build a mock cm_info instance.
150
        // Build a mock cm_info instance.
151
        $mockcminfo = $this->getMockBuilder(cm_info::class)
151
        $mockcminfo = $this->getMockBuilder(cm_info::class)
152
            ->disableOriginalConstructor()
152
            ->disableOriginalConstructor()
Línea 182... Línea 182...
182
     *
182
     *
183
     * @dataProvider get_available_custom_rules_provider
183
     * @dataProvider get_available_custom_rules_provider
184
     * @param int $status
184
     * @param int $status
185
     * @param array $expected
185
     * @param array $expected
186
     */
186
     */
187
    public function test_get_available_custom_rules(int $status, array $expected) {
187
    public function test_get_available_custom_rules(int $status, array $expected): void {
188
        $customdataval = [
188
        $customdataval = [
189
            'customcompletionrules' => [
189
            'customcompletionrules' => [
190
                'completionsubmit' => $status
190
                'completionsubmit' => $status
191
            ]
191
            ]
192
        ];
192
        ];