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 int $entries The number of entries.
77
     * @param int $entries The number of entries.
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, int $entries, ?int $status, ?string $exception) {
81
    public function test_get_state(string $rule, int $available, int $entries, ?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('completionentries', reset($rules));
125
        $this->assertEquals('completionentries', 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 {
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();
134
        // Build a mock cm_info instance.
134
        // Build a mock cm_info instance.
Línea 151... Línea 151...
151
    }
151
    }
Línea 152... Línea 152...
152
 
152
 
153
    /**
153
    /**
154
     * Test for is_defined().
154
     * Test for is_defined().
155
     */
155
     */
156
    public function test_is_defined() {
156
    public function test_is_defined(): void {
157
        // Build a mock cm_info instance.
157
        // Build a mock cm_info instance.
158
        $mockcminfo = $this->getMockBuilder(cm_info::class)
158
        $mockcminfo = $this->getMockBuilder(cm_info::class)
159
            ->disableOriginalConstructor()
159
            ->disableOriginalConstructor()
Línea 189... Línea 189...
189
     *
189
     *
190
     * @dataProvider get_available_custom_rules_provider
190
     * @dataProvider get_available_custom_rules_provider
191
     * @param int $status
191
     * @param int $status
192
     * @param array $expected
192
     * @param array $expected
193
     */
193
     */
194
    public function test_get_available_custom_rules(int $status, array $expected) {
194
    public function test_get_available_custom_rules(int $status, array $expected): void {
195
        $customdataval = [
195
        $customdataval = [
196
            'customcompletionrules' => [
196
            'customcompletionrules' => [
197
                'completionentries' => $status
197
                'completionentries' => $status
198
            ]
198
            ]
199
        ];
199
        ];