_xowiki__slot_interactions (private)
_xowiki__slot_interactions
Defined in packages/xowiki/tcl/test/xowiki-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 {{ set instance /xowiki-test set package_id [::acs::test::require_package_instance -package_key xowiki -empty -instance_name $instance] aa_run_with_teardown -rollback -test_code { set testfolder .testfolder ::xowiki::Package initialize -package $package_id set root_folder_id [::$package_id folder_id] lang::system::set_locale en_US set f1_id [xowiki::test::require_folder "f1" $root_folder_id $package_id] set p0_id [xowiki::test::require_page en:p0 $root_folder_id $package_id] ::xo::db::CrClass get_instance_from_db -item_id $f1_id ::xo::db::CrClass get_instance_from_db -item_id $p0_id aa_section "update from slot on extend_slot (description)" set s [$p0_id find_slot description] aa_true "slot found: $s" {$s ne ""} aa_equals "slot is " $s ::xowiki::Page::slot::description aa_equals "slot domain is " [$s domain] ::xo::db::CrItem aa_equals "old description is" [$p0_id description] "" $p0_id update_attribute_from_slot $s "new description" aa_equals "new description is" [$p0_id description] "new description" set item_id [$p0_id item_id] set d [::xo::dc get_value get_description {select description from xowiki_pagex where item_id = :item_id}] aa_equals "new description from db is" $d "new description" $p0_id destroy ::xo::db::CrClass get_instance_from_db -item_id $p0_id aa_equals "new description is" [$p0_id description] "new description" aa_section "update from slot on plain_slot (creator)" set s [$p0_id find_slot creator] aa_true "slot found: $s" {$s ne ""} aa_equals "slot is " $s ::xowiki::Page::slot::creator aa_equals "slot domain is " [$s domain] ::xowiki::Page aa_equals "old creator is" [$p0_id creator] "" $p0_id update_attribute_from_slot $s "the creator" aa_equals "new creator is" [$p0_id creator] "the creator" set item_id [$p0_id item_id] set d [::xo::dc get_value get_creator {select creator from xowiki_pagex where item_id = :item_id}] aa_equals "new creator from db is" $d "the creator" $p0_id destroy ::xo::db::CrClass get_instance_from_db -item_id $p0_id aa_equals "new creator is" [$p0_id creator] "the creator" # # Form page, update instance attributes (hstore is probably # not activated on most instances) # aa_section "update from slot on instance attributes" set s [$f1_id find_slot instance_attributes] aa_true "slot found: $s" {$s ne ""} aa_equals "slot is " $s ::xowiki::PageInstance::slot::instance_attributes aa_equals "slot domain is " [$s domain] ::xowiki::PageInstance aa_equals "old instance_attributes is" [$f1_id instance_attributes] "" $f1_id update_attribute_from_slot $s "a 1" aa_equals "new instance_attributes is" [$f1_id instance_attributes] "a 1" set item_id [$f1_id item_id] set d [::xo::dc get_value get_description {select instance_attributes from xowiki_form_pagex where item_id = :item_id}] aa_equals "new instance_attributes from db is" $d "a 1" # # Form page, update attribute in item index. # aa_section "update from slot on form page and item index" set s [$f1_id find_slot state] aa_true "slot found: $s" {$s ne ""} aa_equals "slot is " $s ::xowiki::FormPage::slot::state aa_equals "slot domain is " [$s domain] ::xowiki::FormPage set state [::xo::dc get_value get_state {select state from xowiki_form_pagex where item_id = :item_id}] aa_equals "state directly from item index" $state [$f1_id state] foreach state {"" initial teststate} { $f1_id update_attribute_from_slot $s $state aa_equals "state from object is '$state'" [$f1_id state] $state set db_state [::xo::dc get_value get_state {select state from xowiki_form_pagex where item_id = :item_id}] aa_equals "state directly from item index is '$state'" $db_state $state # # Now destroy in memory and refetch to double check, if all is OK. # $f1_id destroy ::xo::db::CrClass get_instance_from_db -item_id $f1_id aa_equals "new instance_attributes is" [$f1_id instance_attributes] "a 1" aa_equals "new state is" [$f1_id state] $state } } -teardown_code { set node_id [site_node::get_node_id -url /$instance] site_node::unmount -node_id $node_id site_node::delete -node_id $node_id -delete_package } }} { 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" "slot_interactions (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle