Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 37... Línea 37...
37
 */
37
 */
38
class date_test extends advanced_testcase {
38
class date_test extends advanced_testcase {
39
    /**
39
    /**
40
     * @covers ::get_default_php_timezone
40
     * @covers ::get_default_php_timezone
41
     */
41
     */
42
    public function test_get_default_php_timezone() {
42
    public function test_get_default_php_timezone(): void {
43
        $this->resetAfterTest();
43
        $this->resetAfterTest();
Línea 44... Línea 44...
44
 
44
 
45
        $origtz = core_date::get_default_php_timezone();
45
        $origtz = core_date::get_default_php_timezone();
Línea 56... Línea 56...
56
    }
56
    }
Línea 57... Línea 57...
57
 
57
 
58
    /**
58
    /**
59
     * @covers ::normalise_timezone
59
     * @covers ::normalise_timezone
60
     */
60
     */
61
    public function test_normalise_timezone() {
61
    public function test_normalise_timezone(): void {
Línea 62... Línea 62...
62
        $this->resetAfterTest();
62
        $this->resetAfterTest();
63
 
63
 
64
        $this->setTimezone('Pacific/Auckland');
64
        $this->setTimezone('Pacific/Auckland');
Línea 123... Línea 123...
123
    }
123
    }
Línea 124... Línea 124...
124
 
124
 
125
    /**
125
    /**
126
     * @covers ::normalise_timezone
126
     * @covers ::normalise_timezone
127
     */
127
     */
128
    public function test_windows_conversion() {
128
    public function test_windows_conversion(): void {
Línea 129... Línea 129...
129
        $file = __DIR__ . '/fixtures/timezonewindows.xml';
129
        $file = __DIR__ . '/fixtures/timezonewindows.xml';
130
 
130
 
Línea 148... Línea 148...
148
    }
148
    }
Línea 149... Línea 149...
149
 
149
 
150
    /**
150
    /**
151
     * Sanity test for PHP stuff.
151
     * Sanity test for PHP stuff.
152
     */
152
     */
153
    public function test_php_gmt_offsets() {
153
    public function test_php_gmt_offsets(): void {
Línea 154... Línea 154...
154
        $this->resetAfterTest();
154
        $this->resetAfterTest();
Línea 155... Línea 155...
155
 
155
 
Línea 180... Línea 180...
180
    /**
180
    /**
181
     * We are only checking lang strings existence here, not code.
181
     * We are only checking lang strings existence here, not code.
182
     *
182
     *
183
     * @coversNothing
183
     * @coversNothing
184
     */
184
     */
185
    public function test_timezone_all_lang_strings() {
185
    public function test_timezone_all_lang_strings(): void {
186
        // We only run this test when PHPUNIT_LONGTEST is enabled, test_get_localised_timezone()
186
        // We only run this test when PHPUNIT_LONGTEST is enabled, test_get_localised_timezone()
187
        // is already checking the names of a few, hopefully stable enough to be run always.
187
        // is already checking the names of a few, hopefully stable enough to be run always.
188
        if (!PHPUNIT_LONGTEST) {
188
        if (!PHPUNIT_LONGTEST) {
189
            $this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
189
            $this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
190
        }
190
        }
Línea 198... Línea 198...
198
    }
198
    }
Línea 199... Línea 199...
199
 
199
 
200
    /**
200
    /**
201
     * @covers ::get_localised_timezone
201
     * @covers ::get_localised_timezone
202
     */
202
     */
203
    public function test_get_localised_timezone() {
203
    public function test_get_localised_timezone(): void {
Línea 204... Línea 204...
204
        $this->resetAfterTest();
204
        $this->resetAfterTest();
Línea 205... Línea 205...
205
 
205
 
Línea 234... Línea 234...
234
    }
234
    }
Línea 235... Línea 235...
235
 
235
 
236
    /**
236
    /**
237
     * @covers ::get_list_of_timezones
237
     * @covers ::get_list_of_timezones
238
     */
238
     */
239
    public function test_get_list_of_timezones() {
239
    public function test_get_list_of_timezones(): void {
Línea 240... Línea 240...
240
        $this->resetAfterTest();
240
        $this->resetAfterTest();
Línea 241... Línea 241...
241
 
241
 
Línea 285... Línea 285...
285
    }
285
    }
Línea 286... Línea 286...
286
 
286
 
287
    /**
287
    /**
288
     * @covers ::get_server_timezone
288
     * @covers ::get_server_timezone
289
     */
289
     */
290
    public function test_get_server_timezone() {
290
    public function test_get_server_timezone(): void {
291
        global $CFG;
291
        global $CFG;
Línea 292... Línea 292...
292
        $this->resetAfterTest();
292
        $this->resetAfterTest();
293
 
293
 
Línea 313... Línea 313...
313
    }
313
    }
Línea 314... Línea 314...
314
 
314
 
315
    /**
315
    /**
316
     * @covers ::get_server_timezone_object
316
     * @covers ::get_server_timezone_object
317
     */
317
     */
318
    public function test_get_server_timezone_object() {
318
    public function test_get_server_timezone_object(): void {
Línea 319... Línea 319...
319
        $this->resetAfterTest();
319
        $this->resetAfterTest();
320
 
320
 
321
        $zones = core_date::get_list_of_timezones();
321
        $zones = core_date::get_list_of_timezones();
Línea 328... Línea 328...
328
    }
328
    }
Línea 329... Línea 329...
329
 
329
 
330
    /**
330
    /**
331
     * @covers ::set_default_server_timezone
331
     * @covers ::set_default_server_timezone
332
     */
332
     */
333
    public function test_set_default_server_timezone() {
333
    public function test_set_default_server_timezone(): void {
334
        global $CFG;
334
        global $CFG;
Línea 335... Línea 335...
335
        $this->resetAfterTest();
335
        $this->resetAfterTest();
336
 
336
 
Línea 450... Línea 450...
450
     * @dataProvider legacyUserTimezoneProvider
450
     * @dataProvider legacyUserTimezoneProvider
451
     * @covers ::get_user_timezone
451
     * @covers ::get_user_timezone
452
     * @param string $tz The legacy timezone.
452
     * @param string $tz The legacy timezone.
453
     * @param string $expected The expected converted timezone.
453
     * @param string $expected The expected converted timezone.
454
     */
454
     */
455
    public function test_get_legacy_user_timezone($tz, $expected) {
455
    public function test_get_legacy_user_timezone($tz, $expected): void {
456
        $this->setTimezone('Australia/Perth', 'Australia/Perth');
456
        $this->setTimezone('Australia/Perth', 'Australia/Perth');
457
        $this->assertEquals($expected, core_date::get_user_timezone($tz));
457
        $this->assertEquals($expected, core_date::get_user_timezone($tz));
458
    }
458
    }
Línea 459... Línea 459...
459
 
459
 
460
    /**
460
    /**
461
     * @covers ::get_user_timezone
461
     * @covers ::get_user_timezone
462
     */
462
     */
463
    public function test_get_user_timezone() {
463
    public function test_get_user_timezone(): void {
464
        global $CFG, $USER;
464
        global $CFG, $USER;
Línea 465... Línea 465...
465
        $this->resetAfterTest();
465
        $this->resetAfterTest();
Línea 597... Línea 597...
597
    }
597
    }
Línea 598... Línea 598...
598
 
598
 
599
    /**
599
    /**
600
     * @covers ::get_user_timezone_object
600
     * @covers ::get_user_timezone_object
601
     */
601
     */
602
    public function test_get_user_timezone_object() {
602
    public function test_get_user_timezone_object(): void {
603
        global $CFG, $USER;
603
        global $CFG, $USER;
Línea 604... Línea 604...
604
        $this->resetAfterTest();
604
        $this->resetAfterTest();
605
 
605