Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 76... Línea 76...
76
     * @param int $available Whether this rule is available.
76
     * @param int $available Whether this rule is available.
77
     * @param bool $submitted
77
     * @param bool $submitted
78
     * @param int|null $status Expected status.
78
     * @param int|null $status Expected status.
79
     * @param string|null $exception Expected exception.
79
     * @param string|null $exception Expected exception.
80
     */
80
     */
81
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception) {
81
    public function test_get_state(string $rule, int $available, ?bool $submitted, ?int $status, ?string $exception): void {
82
        global $DB;
82
        global $DB;
Línea 83... Línea 83...
83
 
83
 
84
        if (!is_null($exception)) {
84
        if (!is_null($exception)) {
85
            $this->expectException($exception);
85
            $this->expectException($exception);
Línea 117... Línea 117...
117
    }
117
    }
Línea 118... Línea 118...
118
 
118
 
119
    /**
119
    /**
120
     * Test for get_defined_custom_rules().
120
     * Test for get_defined_custom_rules().
121
     */
121
     */
122
    public function test_get_defined_custom_rules() {
122
    public function test_get_defined_custom_rules(): void {
123
        $rules = custom_completion::get_defined_custom_rules();
123
        $rules = custom_completion::get_defined_custom_rules();
124
        $this->assertCount(1, $rules);
124
        $this->assertCount(1, $rules);
125
        $this->assertEquals('completionsubmit', reset($rules));
125
        $this->assertEquals('completionsubmit', reset($rules));
Línea 126... Línea 126...
126
    }
126
    }
127
 
127
 
128
    /**
128
    /**
129
     * Test for get_defined_custom_rule_descriptions().
129
     * Test for get_defined_custom_rule_descriptions().
130
     */
130
     */
131
    public function test_get_custom_rule_descriptions() {
131
    public function test_get_custom_rule_descriptions(): void {
Línea 132... Línea 132...
132
        // Get defined custom rules.
132
        // Get defined custom rules.
133
        $rules = custom_completion::get_defined_custom_rules();
133
        $rules = custom_completion::get_defined_custom_rules();
Línea 152... Línea 152...
152
    }
152
    }
Línea 153... Línea 153...
153
 
153
 
154
    /**
154
    /**
155
     * Test for is_defined().
155
     * Test for is_defined().
156
     */
156
     */
157
    public function test_is_defined() {
157
    public function test_is_defined(): void {
158
        // Build a mock cm_info instance.
158
        // Build a mock cm_info instance.
159
        $mockcminfo = $this->getMockBuilder(cm_info::class)
159
        $mockcminfo = $this->getMockBuilder(cm_info::class)
160
            ->disableOriginalConstructor()
160
            ->disableOriginalConstructor()
Línea 190... Línea 190...
190
     *
190
     *
191
     * @dataProvider get_available_custom_rules_provider
191
     * @dataProvider get_available_custom_rules_provider
192
     * @param int $status
192
     * @param int $status
193
     * @param array $expected
193
     * @param array $expected
194
     */
194
     */
195
    public function test_get_available_custom_rules(int $status, array $expected) {
195
    public function test_get_available_custom_rules(int $status, array $expected): void {
196
        $customdataval = [
196
        $customdataval = [
197
            'customcompletionrules' => [
197
            'customcompletionrules' => [
198
                'completionsubmit' => $status
198
                'completionsubmit' => $status
199
            ]
199
            ]
200
        ];
200
        ];