Línea 45... |
Línea 45... |
45 |
* @package core_calendar
|
45 |
* @package core_calendar
|
46 |
* @copyright 2013 Mark Nelson <markn@moodle.com>
|
46 |
* @copyright 2013 Mark Nelson <markn@moodle.com>
|
47 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
47 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
48 |
* @since Moodle 2.6
|
48 |
* @since Moodle 2.6
|
49 |
*/
|
49 |
*/
|
50 |
class calendartype_test extends \advanced_testcase {
|
50 |
final class calendartype_test extends \advanced_testcase {
|
51 |
/** @var MoodleQuickForm Keeps reference of dummy form object */
|
51 |
/** @var MoodleQuickForm Keeps reference of dummy form object */
|
52 |
private $mform;
|
52 |
private $mform;
|
Línea 53... |
Línea 53... |
53 |
|
53 |
|
54 |
/**
|
54 |
/**
|
Línea 58... |
Línea 58... |
58 |
|
58 |
|
59 |
/**
|
59 |
/**
|
60 |
* Test set up.
|
60 |
* Test set up.
|
61 |
*/
|
61 |
*/
|
- |
|
62 |
protected function setUp(): void {
|
62 |
protected function setUp(): void {
|
63 |
parent::setUp();
|
63 |
// The user we are going to test this on.
|
64 |
// The user we are going to test this on.
|
64 |
$this->user = self::getDataGenerator()->create_user();
|
65 |
$this->user = self::getDataGenerator()->create_user();
|
Línea 65... |
Línea 66... |
65 |
self::setUser($this->user);
|
66 |
self::setUser($this->user);
|
Línea 193... |
Línea 194... |
193 |
|
194 |
|
194 |
// Test the userdate function.
|
195 |
// Test the userdate function.
|
195 |
$this->assertEquals($calendar->timestamp_to_date_string($this->user->timecreated, '', 99, true, true),
|
196 |
$this->assertEquals($calendar->timestamp_to_date_string($this->user->timecreated, '', 99, true, true),
|
Línea -... |
Línea 197... |
- |
|
197 |
userdate($this->user->timecreated));
|
- |
|
198 |
|
- |
|
199 |
// Test the userdate function with a timezone.
|
- |
|
200 |
$this->assertEquals(
|
- |
|
201 |
$calendar->timestamp_to_date_string($this->user->timecreated, '', 'Australia/Sydney', true, true),
|
- |
|
202 |
userdate($this->user->timecreated, timezone: 'Australia/Sydney'),
|
196 |
userdate($this->user->timecreated));
|
203 |
);
|
197 |
|
204 |
|
198 |
// Test the calendar/lib.php functions.
|
205 |
// Test the calendar/lib.php functions.
|
199 |
$this->assertEquals($calendar->get_weekdays(), calendar_get_days());
|
206 |
$this->assertEquals($calendar->get_weekdays(), calendar_get_days());
|
200 |
$this->assertEquals($calendar->get_starting_weekday(), calendar_get_starting_weekday());
|
207 |
$this->assertEquals($calendar->get_starting_weekday(), calendar_get_starting_weekday());
|
- |
|
208 |
$this->assertEquals($calendar->get_num_days_in_month('1986', '9'), calendar_days_in_month('9', '1986'));
|
- |
|
209 |
$this->assertEquals($calendar->get_next_month('1986', '9'), calendar_add_month('9', '1986'));
|
- |
|
210 |
$this->assertDebuggingCalled(
|
- |
|
211 |
'Deprecation: calendar_add_month has been deprecated since 5.0. ' .
|
- |
|
212 |
'Use \core_calendar\type_factory::get_calendar_instance()->get_next_month() instead. ' .
|
201 |
$this->assertEquals($calendar->get_num_days_in_month('1986', '9'), calendar_days_in_month('9', '1986'));
|
213 |
'See MDL-84657 for more information.'
|
- |
|
214 |
);
|
- |
|
215 |
$this->assertEquals($calendar->get_prev_month('1986', '9'), calendar_sub_month('9', '1986'));
|
- |
|
216 |
$this->assertDebuggingCalled(
|
- |
|
217 |
'Deprecation: calendar_sub_month has been deprecated since 5.0. ' .
|
202 |
$this->assertEquals($calendar->get_next_month('1986', '9'), calendar_add_month('9', '1986'));
|
218 |
'Use \core_calendar\type_factory::get_calendar_instance()->get_prev_month() instead. ' .
|
203 |
$this->assertEquals($calendar->get_prev_month('1986', '9'), calendar_sub_month('9', '1986'));
|
219 |
'See MDL-79434 for more information.'
|
204 |
|
220 |
);
|
205 |
// Test the lib/moodle.php functions.
|
221 |
// Test the lib/moodle.php functions.
|
206 |
$this->assertEquals($calendar->get_num_days_in_month('1986', '9'), days_in_month('9', '1986'));
|
222 |
$this->assertEquals($calendar->get_num_days_in_month('1986', '9'), days_in_month('9', '1986'));
|