Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 79... Línea 79...
79
     * @param int $available Whether this rule is available.
79
     * @param int $available Whether this rule is available.
80
     * @param bool $submitted
80
     * @param bool $submitted
81
     * @param int|null $status Expected status.
81
     * @param int|null $status Expected status.
82
     * @param string|null $exception Expected exception.
82
     * @param string|null $exception Expected exception.
83
     */
83
     */
84
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception) {
84
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception): void {
85
        if (!is_null($exception)) {
85
        if (!is_null($exception)) {
86
            $this->expectException($exception);
86
            $this->expectException($exception);
87
        }
87
        }
Línea 88... Línea 88...
88
 
88
 
Línea 112... Línea 112...
112
     * @param int $available Whether this rule is available.
112
     * @param int $available Whether this rule is available.
113
     * @param bool $submitted
113
     * @param bool $submitted
114
     * @param int|null $status Expected status.
114
     * @param int|null $status Expected status.
115
     * @param string|null $exception Expected exception.
115
     * @param string|null $exception Expected exception.
116
     */
116
     */
117
    public function test_get_state_group(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception) {
117
    public function test_get_state_group(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception): void {
118
        if (!is_null($exception)) {
118
        if (!is_null($exception)) {
119
            $this->expectException($exception);
119
            $this->expectException($exception);
120
        }
120
        }
Línea 121... Línea 121...
121
 
121
 
Línea 140... Línea 140...
140
 
140
 
141
 
141
 
142
    /**
142
    /**
143
     * Test for get_defined_custom_rules().
143
     * Test for get_defined_custom_rules().
144
     */
144
     */
145
    public function test_get_defined_custom_rules() {
145
    public function test_get_defined_custom_rules(): void {
146
        $rules = custom_completion::get_defined_custom_rules();
146
        $rules = custom_completion::get_defined_custom_rules();
147
        $this->assertCount(1, $rules);
147
        $this->assertCount(1, $rules);
Línea 148... Línea 148...
148
        $this->assertEquals('completionsubmit', reset($rules));
148
        $this->assertEquals('completionsubmit', reset($rules));
149
    }
149
    }
150
 
150
 
151
    /**
151
    /**
152
     * Test for get_defined_custom_rule_descriptions().
152
     * Test for get_defined_custom_rule_descriptions().
153
     */
153
     */
154
    public function test_get_custom_rule_descriptions() {
154
    public function test_get_custom_rule_descriptions(): void {
155
        $this->resetAfterTest();
155
        $this->resetAfterTest();
156
        // Get defined custom rules.
156
        // Get defined custom rules.
Línea 174... Línea 174...
174
    }
174
    }
Línea 175... Línea 175...
175
 
175
 
176
    /**
176
    /**
177
     * Test for is_defined().
177
     * Test for is_defined().
178
     */
178
     */
179
    public function test_is_defined() {
179
    public function test_is_defined(): void {
180
        $this->resetAfterTest();
180
        $this->resetAfterTest();
181
        $course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]);
181
        $course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]);
182
        $assign = $this->create_instance($course, [
182
        $assign = $this->create_instance($course, [
183
            'submissiondrafts' => 0,
183
            'submissiondrafts' => 0,
Línea 216... Línea 216...
216
     *
216
     *
217
     * @dataProvider get_available_custom_rules_provider
217
     * @dataProvider get_available_custom_rules_provider
218
     * @param int $status
218
     * @param int $status
219
     * @param array $expected
219
     * @param array $expected
220
     */
220
     */
221
    public function test_get_available_custom_rules(int $status, array $expected) {
221
    public function test_get_available_custom_rules(int $status, array $expected): void {
222
        $this->resetAfterTest();
222
        $this->resetAfterTest();
223
        $course = $this->getDataGenerator()->create_course(['enablecompletion' => $status]);
223
        $course = $this->getDataGenerator()->create_course(['enablecompletion' => $status]);
Línea 224... Línea 224...
224
 
224
 
225
        $params = [];
225
        $params = [];