Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 58... Línea 58...
58
class logger_test extends \basic_testcase {
58
class logger_test extends \basic_testcase {
Línea 59... Línea 59...
59
 
59
 
60
    /**
60
    /**
61
     * test base_logger class
61
     * test base_logger class
62
     */
62
     */
63
    function test_base_logger() {
63
    function test_base_logger(): void {
64
        // Test logger with simple action (message * level)
64
        // Test logger with simple action (message * level)
65
        $lo = new mock_base_logger1(backup::LOG_ERROR);
65
        $lo = new mock_base_logger1(backup::LOG_ERROR);
66
        $msg = 13;
66
        $msg = 13;
67
        $this->assertEquals($lo->process($msg, backup::LOG_ERROR), $msg * backup::LOG_ERROR);
67
        $this->assertEquals($lo->process($msg, backup::LOG_ERROR), $msg * backup::LOG_ERROR);
Línea 139... Línea 139...
139
    }
139
    }
Línea 140... Línea 140...
140
 
140
 
141
    /**
141
    /**
142
     * test error_log_logger class
142
     * test error_log_logger class
143
     */
143
     */
144
    function test_error_log_logger() {
144
    function test_error_log_logger(): void {
145
        // Not much really to test, just instantiate and execute, should return true
145
        // Not much really to test, just instantiate and execute, should return true
146
        $lo = new error_log_logger(backup::LOG_ERROR);
146
        $lo = new error_log_logger(backup::LOG_ERROR);
147
        $this->assertTrue($lo instanceof error_log_logger);
147
        $this->assertTrue($lo instanceof error_log_logger);
148
        $message = 'This log exists because you have run Moodle unit tests: Ignore it';
148
        $message = 'This log exists because you have run Moodle unit tests: Ignore it';
Línea 151... Línea 151...
151
    }
151
    }
Línea 152... Línea 152...
152
 
152
 
153
    /**
153
    /**
154
     * test output_text_logger class
154
     * test output_text_logger class
155
     */
155
     */
156
    function test_output_text_logger() {
156
    function test_output_text_logger(): void {
157
        // Instantiate without date nor level output
157
        // Instantiate without date nor level output
158
        $lo = new output_text_logger(backup::LOG_ERROR);
158
        $lo = new output_text_logger(backup::LOG_ERROR);
159
        $this->assertTrue($lo instanceof output_text_logger);
159
        $this->assertTrue($lo instanceof output_text_logger);
160
        $message = 'testing output_text_logger';
160
        $message = 'testing output_text_logger';
Línea 181... Línea 181...
181
    }
181
    }
Línea 182... Línea 182...
182
 
182
 
183
    /**
183
    /**
184
     * test output_indented_logger class
184
     * test output_indented_logger class
185
     */
185
     */
186
    function test_output_indented_logger() {
186
    function test_output_indented_logger(): void {
187
        // Instantiate without date nor level output
187
        // Instantiate without date nor level output
188
        $options = array('depth' => 2);
188
        $options = array('depth' => 2);
189
        $lo = new output_indented_logger(backup::LOG_ERROR);
189
        $lo = new output_indented_logger(backup::LOG_ERROR);
190
        $this->assertTrue($lo instanceof output_indented_logger);
190
        $this->assertTrue($lo instanceof output_indented_logger);
Línea 224... Línea 224...
224
    }
224
    }
Línea 225... Línea 225...
225
 
225
 
226
    /**
226
    /**
227
     * test database_logger class
227
     * test database_logger class
228
     */
228
     */
229
    function test_database_logger() {
229
    function test_database_logger(): void {
230
        // Instantiate with date and level output (and with specs from the global moodle "log" table so checks will pass
230
        // Instantiate with date and level output (and with specs from the global moodle "log" table so checks will pass
231
        $now = time();
231
        $now = time();
232
        $datecol = 'time';
232
        $datecol = 'time';
233
        $levelcol = 'action';
233
        $levelcol = 'action';
Línea 248... Línea 248...
248
    }
248
    }
Línea 249... Línea 249...
249
 
249
 
250
    /**
250
    /**
251
     * test file_logger class
251
     * test file_logger class
252
     */
252
     */
253
    function test_file_logger() {
253
    function test_file_logger(): void {
Línea 254... Línea 254...
254
        global $CFG;
254
        global $CFG;
255
 
255
 
256
        $file = $CFG->tempdir . '/test/test_file_logger.txt';
256
        $file = $CFG->tempdir . '/test/test_file_logger.txt';