_acs-subsite__acs_subsite_attributes (private)
_acs-subsite__acs_subsite_attributes
Defined in packages/acs-subsite/tcl/test/acs-subsite-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 {{ aa_run_with_teardown -rollback -test_code { # # Create new dynamic object_type # set pretty_name "foo_type" set object_type $pretty_name set name_method "${object_type}.name" if {[db_name] eq "PostgreSQL"} { set type_create_sql "select acs_object_type__create_type ( :object_type, :pretty_name, :pretty_name, 'acs_object', null, null, null, 'f', null, :name_method, 't', 't');" } else { # oracle set type_create_sql "begin acs_object_type.create_type ( object_type => :object_type, pretty_name => :pretty_name, pretty_plural => :pretty_name, supertype => 'acs_object', abstract_p => 'f', name_method => :name_method, create_table_p => 't', dynamic_p => 't'); end;" } aa_log "Create object_type: $object_type" db_exec_plsql type_create $type_create_sql # # Create new attribute # set attribute_name "foo" set attribute_name_plural "foos" set attribute_type "text" set min_n_values 1 set max_n_values 1 set default_value "fooooo" aa_log "Add new attribute $attribute_name to object_type: $object_type" set attribute_id [attribute::add -min_n_values $min_n_values -max_n_values $max_n_values -default $default_value $object_type $attribute_type $attribute_name $attribute_name_plural] aa_true "New attribute exists" [attribute::exists_p $object_type $attribute_name] # # Add value to attribute # set enum_value "enum_foo" set sort_order "1" attribute::value_add $attribute_id $enum_value $sort_order set value_exists_p [db_0or1row value { select 1 from acs_enum_values where attribute_id=:attribute_id and enum_value=:enum_value }] aa_true "Value added to attribute" "$value_exists_p" dict set cases attribute_dynamic_p [list $attribute_id 1 1 0] foreach filter [dict keys $cases] { foreach { value result } [dict get $cases $filter] { if { $result } { aa_true "'[ns_quotehtml $value]' is $filter" [ad_page_contract_filter_invoke $filter dummy value] } else { aa_false "'[ns_quotehtml $value]' is NOT $filter" [ad_page_contract_filter_invoke $filter dummy value] } } } # # Delete value from attribute # attribute::value_delete $attribute_id $enum_value set value_exists_p [db_0or1row value { select 1 from acs_enum_values where attribute_id=:attribute_id and enum_value=:enum_value }] aa_false "Value exists after deletion" "$value_exists_p" # # Delete attribute # attribute::delete $attribute_id aa_false "Attribute exists after deletion" [attribute::exists_p $object_type $attribute_name] } }} { 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" "acs_subsite_attributes (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle