Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 23... Línea 23...
23
 * @copyright 2015 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
23
 * @copyright 2015 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
24
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25
 * @author    Petr Skoda <petr.skoda@totaralms.com>
25
 * @author    Petr Skoda <petr.skoda@totaralms.com>
26
 */
26
 */
27
class date_legacy_test extends \advanced_testcase {
27
class date_legacy_test extends \advanced_testcase {
28
    public function test_settings() {
28
    public function test_settings(): void {
29
        global $CFG;
29
        global $CFG;
30
        $this->resetAfterTest();
30
        $this->resetAfterTest();
Línea 31... Línea 31...
31
 
31
 
Línea 35... Línea 35...
35
 
35
 
36
        $user = $this->getDataGenerator()->create_user();
36
        $user = $this->getDataGenerator()->create_user();
37
        $this->assertSame('99', $user->timezone);
37
        $this->assertSame('99', $user->timezone);
Línea 38... Línea 38...
38
    }
38
    }
39
 
39
 
Línea 40... Línea 40...
40
    public function test_get_user_timezone() {
40
    public function test_get_user_timezone(): void {
Línea 41... Línea 41...
41
        global $CFG, $USER;
41
        global $CFG, $USER;
Línea 108... Línea 108...
108
 
108
 
109
        $tz = get_user_timezone('Europe/Berlin');
109
        $tz = get_user_timezone('Europe/Berlin');
110
        $this->assertSame('Europe/Berlin', $tz);
110
        $this->assertSame('Europe/Berlin', $tz);
Línea 111... Línea 111...
111
    }
111
    }
112
 
112
 
113
    public function test_dst_offset_on() {
113
    public function test_dst_offset_on(): void {
114
        $time = gmmktime(1, 1, 1, 3, 1, 2015);
114
        $time = gmmktime(1, 1, 1, 3, 1, 2015);
115
        $this->assertSame(3600, dst_offset_on($time, 'Pacific/Auckland'));
115
        $this->assertSame(3600, dst_offset_on($time, 'Pacific/Auckland'));
116
        $this->assertSame(0, dst_offset_on($time, 'Australia/Perth'));
116
        $this->assertSame(0, dst_offset_on($time, 'Australia/Perth'));
Línea 124... Línea 124...
124
        $this->assertSame(0, dst_offset_on($time, 'Australia/Lord_Howe'));
124
        $this->assertSame(0, dst_offset_on($time, 'Australia/Lord_Howe'));
125
        $this->assertSame(3600, dst_offset_on($time, 'Europe/Prague'));
125
        $this->assertSame(3600, dst_offset_on($time, 'Europe/Prague'));
126
        $this->assertSame(3600, dst_offset_on($time, 'America/New_York'));
126
        $this->assertSame(3600, dst_offset_on($time, 'America/New_York'));
127
    }
127
    }
Línea 128... Línea 128...
128
 
128
 
129
    public function test_make_timestamp() {
129
    public function test_make_timestamp(): void {
Línea 130... Línea 130...
130
        global $CFG;
130
        global $CFG;
Línea 131... Línea 131...
131
 
131
 
Línea 169... Línea 169...
169
                }
169
                }
170
            }
170
            }
171
        }
171
        }
172
    }
172
    }
Línea 173... Línea 173...
173
 
173
 
174
    public function test_usergetdate() {
174
    public function test_usergetdate(): void {
Línea 175... Línea 175...
175
        global $CFG;
175
        global $CFG;
Línea 176... Línea 176...
176
 
176
 
Línea 240... Línea 240...
240
                }
240
                }
241
            }
241
            }
242
        }
242
        }
243
    }
243
    }
Línea 244... Línea 244...
244
 
244
 
245
    public function test_userdate() {
245
    public function test_userdate(): void {
Línea 246... Línea 246...
246
        global $CFG;
246
        global $CFG;
Línea 247... Línea 247...
247
 
247
 
Línea 282... Línea 282...
282
                }
282
                }
283
            }
283
            }
284
        }
284
        }
285
    }
285
    }
Línea 286... Línea 286...
286
 
286
 
287
    public function test_usertime() {
287
    public function test_usertime(): void {
Línea 288... Línea 288...
288
        // This is a useless bad hack, it needs to be completely eliminated.
288
        // This is a useless bad hack, it needs to be completely eliminated.
289
 
289
 
290
        $time = gmmktime(1, 1, 1, 3, 1, 2015);
290
        $time = gmmktime(1, 1, 1, 3, 1, 2015);
Línea 302... Línea 302...
302
        $this->assertSame($time - (60 * 60 * 8), usertime($time, 'Australia/Perth'));
302
        $this->assertSame($time - (60 * 60 * 8), usertime($time, 'Australia/Perth'));
303
        $this->assertSame($time - (60 * 60 * 12), usertime($time, 'Pacific/Auckland'));
303
        $this->assertSame($time - (60 * 60 * 12), usertime($time, 'Pacific/Auckland'));
304
        $this->assertSame($time - (60 * 60 * -5), usertime($time, 'America/New_York'));
304
        $this->assertSame($time - (60 * 60 * -5), usertime($time, 'America/New_York'));
305
    }
305
    }
Línea 306... Línea 306...
306
 
306
 
307
    public function test_usertimezone() {
307
    public function test_usertimezone(): void {
308
        global $USER;
308
        global $USER;
Línea 309... Línea 309...
309
        $this->resetAfterTest();
309
        $this->resetAfterTest();