_acs-lang__set_get_timezone (private)
_acs-lang__set_get_timezone
Defined in packages/acs-lang/tcl/test/acs-lang-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ # Make sure we have a logged-in user set org_user_id [ad_conn user_id] if { $org_user_id == 0 } { set user_id [db_string user { select min(user_id) from users }] ad_conn -set user_id $user_id } else { set user_id $org_user_id } # Remember originals so we can restore them set system_timezone [lang::system::timezone] set user_timezone [lang::user::timezone] set timezones [lc_list_all_timezones] set n [expr {[llength $timezones]-1}] set desired_user_timezone [lindex $timezones [util::random_range $n] 0] set desired_system_timezone [lindex $timezones [util::random_range $n] 0] set error_p 0 ad_try { # User timezone lang::user::set_timezone $desired_user_timezone aa_equals "User timezone retrieved is the same as the one set" [lang::user::timezone] $desired_user_timezone # Storage set user_id [ad_conn user_id] aa_equals "User timezone stored in user_preferences table" [db_string user_prefs { select timezone from user_preferences where user_id = :user_id }] $desired_user_timezone # System timezone lang::system::set_timezone $desired_system_timezone aa_equals "System timezone retrieved is the same as the one set" [lang::system::timezone] $desired_system_timezone # Connection timezone aa_equals "Using user timezone" [lang::conn::timezone] $desired_user_timezone ad_conn -set isconnected 0 aa_equals "Fallback to system timezone when no connection" [lang::conn::timezone] $desired_system_timezone ad_conn -set isconnected 1 lang::user::set_timezone {} aa_equals "Fallback to system timezone when no user pref" [lang::conn::timezone] $desired_system_timezone } on error {errorMsg} { set error_p 1 # rethrow the error error $errorMsg $::errorInfo } finally { lang::system::set_timezone $system_timezone lang::user::set_timezone $user_timezone ad_conn -set user_id $org_user_id } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "set_get_timezone (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle