Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 28... Línea 28...
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @covers \core\attribute\deprecated
29
 * @covers \core\attribute\deprecated
30
 * @covers \core\attribute\deprecated_with_reference
30
 * @covers \core\attribute\deprecated_with_reference
31
 * @covers \core\deprecation
31
 * @covers \core\deprecation
32
 */
32
 */
33
class deprecation_test extends \advanced_testcase {
33
final class deprecation_test extends \advanced_testcase {
34
    /**
34
    /**
35
     * @dataProvider emit_provider
35
     * @dataProvider emit_provider
36
     */
36
     */
37
    public function test_emit(
37
    public function test_emit(
38
        array $args,
38
        array $args,
Línea 185... Línea 185...
185
                'Deprecation: Test description has been deprecated. See MDL-80677 for more information.',
185
                'Deprecation: Test description has been deprecated. See MDL-80677 for more information.',
186
            ],
186
            ],
187
        ];
187
        ];
188
    }
188
    }
Línea 189... Línea 189...
189
 
189
 
190
    public function test_deprecated_without_replacement(): void {
190
    public function test_deprecated_missing_constuctor_parameters(): void {
-
 
191
        $this->expectException(\coding_exception::class);
191
        $this->expectException(\coding_exception::class);
192
        $this->expectExceptionMessage('A deprecated item must provide either a replacement, reason, or an issue number.');
192
        new deprecated(
-
 
193
            replacement: null,
-
 
194
        );
193
        new deprecated();
Línea 195... Línea 194...
195
    }
194
    }
196
 
195
 
197
    /**
196
    /**
Línea 204... Línea 203...
204
            $this->assertTrue(deprecation::is_deprecated($reference));
203
            $this->assertTrue(deprecation::is_deprecated($reference));
205
            $this->assertDebuggingNotCalled();
204
            $this->assertDebuggingNotCalled();
Línea 206... Línea 205...
206
 
205
 
207
            deprecation::emit_deprecation_if_present($reference);
206
            deprecation::emit_deprecation_if_present($reference);
-
 
207
            $this->assertDebuggingCalled(deprecation::get_deprecation_string($attribute));
-
 
208
 
-
 
209
            deprecation::emit_deprecation($reference);
208
            $this->assertDebuggingCalled(deprecation::get_deprecation_string($attribute));
210
            $this->assertDebuggingCalled(deprecation::get_deprecation_string($attribute));
209
        } else {
211
        } else {
210
            $this->assertNull($attribute);
212
            $this->assertNull($attribute);
211
            $this->assertFalse(deprecation::is_deprecated($reference));
213
            $this->assertFalse(deprecation::is_deprecated($reference));
212
            deprecation::emit_deprecation_if_present($reference);
214
            deprecation::emit_deprecation_if_present($reference);
-
 
215
            $this->assertDebuggingNotCalled();
-
 
216
 
-
 
217
            deprecation::emit_deprecation($reference);
213
            $this->assertDebuggingNotCalled();
218
            $this->assertDebuggingCalled("Deprecation notice requested but object is not deprecated.");
214
        }
219
        }
Línea 215... Línea 220...
215
    }
220
    }
216
 
221