_acs-lang__test_message_register (private)

 _acs-lang__test_message_register

Defined in packages/acs-lang/tcl/test/acs-lang-message-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_false aa_false (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) _acs-lang__test_message_register _acs-lang__test_message_register _acs-lang__test_message_register->aa_equals _acs-lang__test_message_register->aa_false _acs-lang__test_message_register->aa_log _acs-lang__test_message_register->aa_log_result _acs-lang__test_message_register->aa_run_with_teardown

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    aa_run_with_teardown -rollback -test_code {

        set message_key [ad_generate_random_string]
        set message [ad_generate_random_string]
        set package_key "acs-translations"
        set locale "en_US"
        aa_log "Creating message : $message || message key: $message_key"

        # Creates the new message
        lang::message::register $locale $package_key $message_key $message

        # Try to retrieve the new message created.

        lang::message::get  -package_key $package_key  -message_key $message_key  -locale $locale  -array message_new

        aa_equals "Message add succeeded" $message_new(message) $message

        aa_log "Soft-delete the message"
        lang::message::delete  -package_key $package_key  -message_key $message_key  -locale $locale

        set key "${package_key}.${message_key}"
        aa_false "The nsv was deleted" [nsv_exists lang_message_$locale $key]

        aa_log "Delete the nsv regardless to simulate the behavior after restart"
        nsv_unset -nocomplain -- lang_message_$locale $key

        aa_true "Message still exists, flagged as deleted" [db_0or1row check {
            select 1 from lang_messages
            where locale = :locale
            and package_key = :package_key
            and message_key = :message_key
            and deleted_p
        }]

        # Register the message again
        lang::message::register $locale $package_key $message_key $message

        aa_true "Message was reinstated" [db_0or1row check {
            select 1 from lang_messages
            where locale = :locale
            and package_key = :package_key
            and message_key = :message_key
            and not deleted_p
        }]
    }
}} {
          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" "test_message_register (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: