Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 25... Línea 25...
25
 */
25
 */
26
class service_exception_handler_test extends \advanced_testcase {
26
class service_exception_handler_test extends \advanced_testcase {
27
    /**
27
    /**
28
     * Testing service error handling.
28
     * Testing service error handling.
29
     */
29
     */
30
    public function test_handle() {
30
    public function test_handle(): void {
31
        $handler = new service_exception_handler(false);
31
        $handler = new service_exception_handler(false);
32
        $handler->set_message_id('123');
32
        $handler->set_message_id('123');
33
        $handler->set_message_type('testRequest');
33
        $handler->set_message_type('testRequest');
34
        $handler->handle(new \Exception('Error happened'));
34
        $handler->handle(new \Exception('Error happened'));
Línea 41... Línea 41...
41
    }
41
    }
Línea 42... Línea 42...
42
 
42
 
43
    /**
43
    /**
44
     * Testing service error handling when message ID and type are not known yet.
44
     * Testing service error handling when message ID and type are not known yet.
45
     */
45
     */
46
    public function test_handle_early_error() {
46
    public function test_handle_early_error(): void {
47
        $handler = new service_exception_handler(false);
47
        $handler = new service_exception_handler(false);
Línea 48... Línea 48...
48
        $handler->handle(new \Exception('Error happened'));
48
        $handler->handle(new \Exception('Error happened'));
49
 
49
 
Línea 55... Línea 55...
55
    }
55
    }
Línea 56... Línea 56...
56
 
56
 
57
    /**
57
    /**
58
     * Testing that a log file is generated when logging is turned on.
58
     * Testing that a log file is generated when logging is turned on.
59
     */
59
     */
60
    public function test_handle_log() {
60
    public function test_handle_log(): void {
Línea 61... Línea 61...
61
        global $CFG;
61
        global $CFG;
Línea 62... Línea 62...
62
 
62