Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 102... Línea 102...
102
     * @param int|null $posts The number of posts.
102
     * @param int|null $posts The number of posts.
103
     * @param int|null $status Expected status.
103
     * @param int|null $status Expected status.
104
     * @param string|null $exception Expected exception.
104
     * @param string|null $exception Expected exception.
105
     */
105
     */
106
    public function test_get_state(string $rule, int $rulecount, int $available, ?int $discussions, ?int $replies,
106
    public function test_get_state(string $rule, int $rulecount, int $available, ?int $discussions, ?int $replies,
107
                                   ?int $posts, ?int $status, ?string $exception) {
107
                                   ?int $posts, ?int $status, ?string $exception): void {
Línea 108... Línea 108...
108
 
108
 
109
        if (!is_null($exception)) {
109
        if (!is_null($exception)) {
110
            $this->expectException($exception);
110
            $this->expectException($exception);
Línea 158... Línea 158...
158
    }
158
    }
Línea 159... Línea 159...
159
 
159
 
160
    /**
160
    /**
161
     * Test for get_defined_custom_rules().
161
     * Test for get_defined_custom_rules().
162
     */
162
     */
163
    public function test_get_defined_custom_rules() {
163
    public function test_get_defined_custom_rules(): void {
164
        $rules = custom_completion::get_defined_custom_rules();
164
        $rules = custom_completion::get_defined_custom_rules();
165
        $this->assertCount(3, $rules);
165
        $this->assertCount(3, $rules);
166
        $this->assertEquals('completiondiscussions', reset($rules));
166
        $this->assertEquals('completiondiscussions', reset($rules));
Línea 167... Línea 167...
167
    }
167
    }
168
 
168
 
169
    /**
169
    /**
170
     * Test for get_defined_custom_rule_descriptions().
170
     * Test for get_defined_custom_rule_descriptions().
171
     */
171
     */
172
    public function test_get_custom_rule_descriptions() {
172
    public function test_get_custom_rule_descriptions(): void {
Línea 173... Línea 173...
173
        // Get defined custom rules.
173
        // Get defined custom rules.
174
        $rules = custom_completion::get_defined_custom_rules();
174
        $rules = custom_completion::get_defined_custom_rules();
Línea 192... Línea 192...
192
    }
192
    }
Línea 193... Línea 193...
193
 
193
 
194
    /**
194
    /**
195
     * Test for is_defined().
195
     * Test for is_defined().
196
     */
196
     */
197
    public function test_is_defined() {
197
    public function test_is_defined(): void {
198
        // Build a mock cm_info instance.
198
        // Build a mock cm_info instance.
199
        $mockcminfo = $this->getMockBuilder(cm_info::class)
199
        $mockcminfo = $this->getMockBuilder(cm_info::class)
200
            ->disableOriginalConstructor()
200
            ->disableOriginalConstructor()
Línea 242... Línea 242...
242
     *
242
     *
243
     * @dataProvider get_available_custom_rules_provider
243
     * @dataProvider get_available_custom_rules_provider
244
     * @param int $status
244
     * @param int $status
245
     * @param array $expected
245
     * @param array $expected
246
     */
246
     */
247
    public function test_get_available_custom_rules(int $status, array $expected) {
247
    public function test_get_available_custom_rules(int $status, array $expected): void {
248
        $customdataval = [
248
        $customdataval = [
249
            'customcompletionrules' => []
249
            'customcompletionrules' => []
250
        ];
250
        ];
251
        if ($status == COMPLETION_ENABLED) {
251
        if ($status == COMPLETION_ENABLED) {
252
            $rule = $expected[0];
252
            $rule = $expected[0];