_general-comments__general_comments_create_retrieve (private)

 _general-comments__general_comments_create_retrieve

Defined in packages/general-comments/tcl/test/general-comments-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 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) aa_section aa_section (public) _general-comments__general_comments_create_retrieve _general-comments__general_comments_create_retrieve _general-comments__general_comments_create_retrieve->aa_false _general-comments__general_comments_create_retrieve->aa_log _general-comments__general_comments_create_retrieve->aa_log_result _general-comments__general_comments_create_retrieve->aa_run_with_teardown _general-comments__general_comments_create_retrieve->aa_section

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        aa_run_with_teardown -rollback -test_code {
            set object_id [db_string get_object {
                select object_id from acs_objects
                where object_type <> 'apm_package'
                fetch first 1 rows only
            }]

            set context_id [db_string get_package {
                select package_id from apm_packages fetch first 1 rows only
            }]

            set other_context_id [db_string get_package {
                select package_id from apm_packages
                where package_id <> :context_id
                fetch first 1 rows only
            }]

            set comments_info [list]
            for {set i 0} {$i < 5} {incr i} {
                set comment_id [db_nextval acs_object_id_seq]
                set title [ad_generate_random_string]
                set category [ad_generate_random_string]
                set content [ad_generate_random_string]
                general_comments_new  -object_id $object_id  -comment_id $comment_id  -title $title  -comment_mime_type "text/plain"  -context_id $context_id  -category $category  -content $content  -is_live true
                lappend comments_info [list  comment_id $comment_id  title $title  category $category  content $content]
            }

            aa_section "Check that comment has been stored as expected (e.g. category)"
            foreach c $comments_info {
                set comment_id [dict get $c comment_id]
                set category [dict get $c category]
                aa_true "Comment '$comment_id' was stored correctly" [db_0or1row check_comment {
                    select 1
                    from general_comments c, acs_objects o
                    where c.comment_id = o.object_id
                    and c.category = :category
                    and c.object_id = :object_id
                    and o.context_id = :context_id
                    and c.comment_id = :comment_id
                }]
            }

            aa_section "Rendering comments for '$object_id': no content, no context constraint"
            set comments [general_comments_get_comments $object_id]
            aa_true "Generated rendering is HTML" [ad_looks_like_html_p $comments]
            foreach c $comments_info {
                set comment_id [dict get $c comment_id]
                aa_true "Comment Id '$comment_id' is in markup" {[string first $comment_id $comments] >= 0}

                set title [dict get $c title]
                aa_true "Title '$title' is in markup" {[string first $title $comments] >= 0}

                set content [dict get $c content]
                aa_false "Content '$content' is not in markup" {[string first $content $comments] >= 0}
            }

            aa_section "Rendering comments for '$object_id': with content, filtering for another context_id"
            set comments [general_comments_get_comments -print_content_p 1 $object_id]
            aa_true "Generated rendering is HTML" [ad_looks_like_html_p $comments]
            foreach c $comments_info {
                set comment_id [dict get $c comment_id]
                aa_true "Comment Id '$comment_id' is in markup" {[string first $comment_id $comments] >= 0}

                set title [dict get $c title]
                aa_true "Title '$title' is in markup" {[string first $title $comments] >= 0}

                set content [dict get $c content]
                aa_true "Content '$content' is in markup" {[string first $content $comments] >= 0}
            }

            aa_section "Rendering comments for '$object_id': with content and context constraint"
            set comments [general_comments_get_comments  -print_content_p 1  -context_id $other_context_id  $object_id]
            foreach c $comments_info {
                set comment_id [dict get $c comment_id]
                aa_false "Comment Id '$comment_id' is not in markup" {[string first $comment_id $comments] >= 0}

                set title [dict get $c title]
                aa_false "Title '$title' is not in markup" {[string first $title $comments] >= 0}

                set content [dict get $c content]
                aa_false "Content '$content' is not in markup" {[string first $content $comments] >= 0}
            }
        }
    }} {
          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" "general_comments_create_retrieve (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: