From ad7dda9b75e846c2af2d2f0d2256364412084c08 Mon Sep 17 00:00:00 2001 From: ucorina Date: Tue, 1 Nov 2011 15:43:44 +0000 Subject: [PATCH] Updated unit tests - added input XML queries directly in the tests folder, instead of including them from core (for opage and syndication modules, which were removed). git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9786 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- ...Test.php => ConditionWithArgumentTest.php} | 42 +-- .../xml/xmlquery/argument/ArgumentTest.php | 13 +- .../argument/ConditionArgumentTest.php | 14 +- .../xml/xmlquery/argument/data/en.lang.php | 322 ++++++++++++++++++ .../tags/condition/ConditionTagTest.php | 8 +- .../xml/xmlquery/tags/table/TableTagTest.php | 76 ++--- .../xml/xmlquery/tags/table/TablesTagTest.php | 44 +-- test-phpUnit/db/CubridOnlineTest.php | 1 + test-phpUnit/db/MssqlOnlineTest.php | 1 + .../db/xml_query/cubrid/CubridSelectTest.php | 18 +- .../cubrid/data/opage.getOpageList.xml | 24 ++ .../data/syndication.getGrantedModules.xml | 19 ++ .../cubrid/data/syndication.getModules.xml | 26 ++ .../db/xml_query/mssql/MssqlSelectTest.php | 4 +- .../mssql/data/opage.getOpageList.xml | 24 ++ .../data/syndication.getGrantedModule.xml | 17 + .../db/xml_query/mysql/MysqlSelectTest.php | 6 +- .../mysql/data/resource.getLatestItem.xml | 40 +++ .../mysql/data/resource.getLatestItemList.xml | 60 ++++ 19 files changed, 646 insertions(+), 113 deletions(-) rename test-phpUnit/classes/db/queryparts/condition/{ConditionTest.php => ConditionWithArgumentTest.php} (69%) create mode 100644 test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php create mode 100644 test-phpUnit/db/xml_query/cubrid/data/opage.getOpageList.xml create mode 100644 test-phpUnit/db/xml_query/cubrid/data/syndication.getGrantedModules.xml create mode 100644 test-phpUnit/db/xml_query/cubrid/data/syndication.getModules.xml create mode 100644 test-phpUnit/db/xml_query/mssql/data/opage.getOpageList.xml create mode 100644 test-phpUnit/db/xml_query/mssql/data/syndication.getGrantedModule.xml create mode 100644 test-phpUnit/db/xml_query/mysql/data/resource.getLatestItem.xml create mode 100644 test-phpUnit/db/xml_query/mysql/data/resource.getLatestItemList.xml diff --git a/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php b/test-phpUnit/classes/db/queryparts/condition/ConditionWithArgumentTest.php similarity index 69% rename from test-phpUnit/classes/db/queryparts/condition/ConditionTest.php rename to test-phpUnit/classes/db/queryparts/condition/ConditionWithArgumentTest.php index 5b0d54d1a..6809b01a6 100644 --- a/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php +++ b/test-phpUnit/classes/db/queryparts/condition/ConditionWithArgumentTest.php @@ -1,44 +1,44 @@ assertEquals(' "member_srl" = 20', $tag->toString()); - } - + } + /** * Checks equal operation */ public function testConditionString_Equal_WithPipe_NumericValue() { $member_srl_argument = new ConditionArgument('"member_srl"', 20, 'equal'); - - $tag = new Condition('"member_srl"', $member_srl_argument, 'equal', 'and'); - + + $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'equal', 'and'); + $this->assertEquals('and "member_srl" = 20', $tag->toString()); - } - + } + /** * Checks condition returns nothing when argument is not valid */ public function testConditionString_InvalidArgument() { $member_srl_argument = new ConditionArgument('"member_srl"', null, 'equal'); $member_srl_argument->checkNotNull(); - - $tag = new Condition('"member_srl"', $member_srl_argument, 'equal', 'and'); - + + $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'equal', 'and'); + $this->assertEquals('', $tag->toString()); - } - + } + /** * Checks "in" operation */ @@ -46,11 +46,11 @@ class ConditionTest extends CubridTest { $member_srl_argument = new ConditionArgument('"member_srl"', array('a', 'b', 'c'), 'in'); $member_srl_argument->createConditionValue(); $member_srl_argument->setColumnType('varchar'); - - $tag = new Condition('"member_srl"', $member_srl_argument, 'in'); - + + $tag = new ConditionWithArgument('"member_srl"', $member_srl_argument, 'in'); + $this->assertEquals(' "member_srl" in (\'a\',\'b\',\'c\')', $tag->toString()); - } + } } ?> diff --git a/test-phpUnit/classes/xml/xmlquery/argument/ArgumentTest.php b/test-phpUnit/classes/xml/xmlquery/argument/ArgumentTest.php index 71000d669..905936df4 100644 --- a/test-phpUnit/classes/xml/xmlquery/argument/ArgumentTest.php +++ b/test-phpUnit/classes/xml/xmlquery/argument/ArgumentTest.php @@ -8,8 +8,7 @@ class ArgumentTest extends CubridTest { public function testErrorMessageIsSent_NotNullCheck(){ global $lang; - include(_XE_PATH_.'common/lang/en.lang.php'); - + include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); $page_argument = new Argument('page', $args->page); $page_argument->checkNotNull(); $this->assertFalse($page_argument->isValid()); @@ -18,7 +17,7 @@ class ArgumentTest extends CubridTest { public function testErrorMessageIsSent_MinLengthCheck(){ global $lang; - include(_XE_PATH_.'common/lang/en.lang.php'); + include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); $args->page = '123'; $page_argument = new Argument('page', $args->page); @@ -29,7 +28,7 @@ class ArgumentTest extends CubridTest { public function testErrorMessageIsSent_MaxLengthCheck(){ global $lang; - include(_XE_PATH_.'common/lang/en.lang.php'); + include(_TEST_PATH_ . "classes/xml/xmlquery/argument/data/en.lang.php"); $args->page = '123'; $page_argument = new Argument('page', $args->page); @@ -215,7 +214,7 @@ class ArgumentTest extends CubridTest { $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_prefix'); $member_srl_argument->createConditionValue(); - $this->assertEquals('forum%', $member_srl_argument->getValue()); + $this->assertEquals('\'forum%\'', $member_srl_argument->getValue()); } /** @@ -225,7 +224,7 @@ class ArgumentTest extends CubridTest { $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_tail'); $member_srl_argument->createConditionValue(); - $this->assertEquals('%forum', $member_srl_argument->getValue()); + $this->assertEquals('\'%forum\'', $member_srl_argument->getValue()); } /** @@ -235,7 +234,7 @@ class ArgumentTest extends CubridTest { $member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like'); $member_srl_argument->createConditionValue(); - $this->assertEquals('%forum%', $member_srl_argument->getValue()); + $this->assertEquals('\'%forum%\'', $member_srl_argument->getValue()); } diff --git a/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php b/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php index 633e00cfb..17b43a3b5 100644 --- a/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php +++ b/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php @@ -12,23 +12,23 @@ class ConditionArgumentTest extends CubridTest { $document_srl_argument->createConditionValue(); if(!$document_srl_argument->isValid()) return $document_srl_argument->getErrorMessage(); $document_srl_argument->setColumnType('number'); - - $condition = new Condition('"extra_vars"."document_srl"',$document_srl_argument,"in", 'and'); + + $condition = new ConditionWithArgument('"extra_vars"."document_srl"',$document_srl_argument,"in", 'and'); $this->assertEquals('and "extra_vars"."document_srl" in (1234)', $condition->toString()); } - + function testZeroValue(){ $args->site_srl = 0; $site_srl_argument = new ConditionArgument('site_srl', $args->site_srl, 'equal'); $site_srl_argument->checkNotNull(); $site_srl_argument->createConditionValue(); if(!$site_srl_argument->isValid()) return $site_srl_argument->getErrorMessage(); - $site_srl_argument->setColumnType('number'); - - $condition = new Condition('"sites"."site_srl"',$site_srl_argument,"equal"); + $site_srl_argument->setColumnType('number'); + + $condition = new ConditionWithArgument('"sites"."site_srl"',$site_srl_argument,"equal"); $this->assertEquals(' "sites"."site_srl" = 0', $condition->toString()); } - + /** * @todo Implement testCreateConditionValue(). */ diff --git a/test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php b/test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php new file mode 100644 index 000000000..0f4def84e --- /dev/null +++ b/test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php @@ -0,0 +1,322 @@ +cmd_write = 'Write'; +$lang->cmd_reply = 'Reply'; +$lang->cmd_delete = 'Delete'; +$lang->cmd_modify = 'Modify'; +$lang->cmd_edit = 'Edit'; +$lang->cmd_view = 'View'; +$lang->cmd_view_all = 'View All'; +$lang->cmd_list = 'List'; +$lang->cmd_prev = 'Prev'; +$lang->cmd_next = 'Next'; +$lang->cmd_send_trackback = 'Send Trackback'; +$lang->cmd_registration = $lang->cmd_submit = 'Submit'; +$lang->cmd_comment_registration = 'Add Comment'; +$lang->cmd_insert = 'Insert'; +$lang->cmd_save = 'Save'; +$lang->cmd_load = 'Load'; +$lang->cmd_input = 'Input'; +$lang->cmd_search = 'Search'; +$lang->cmd_find = 'Find'; +$lang->cmd_replace = 'Replace'; +$lang->cmd_confirm = 'Confirm'; +$lang->cmd_cancel = 'Cancel'; +$lang->cmd_back = 'Go Back'; +$lang->cmd_vote = 'Recommend'; +$lang->cmd_vote_down = 'Criticize'; +$lang->cmd_declare = 'Accuse'; +$lang->cmd_cancel_declare = 'Cancel Accuse'; +$lang->cmd_declared_list = 'Accusations List'; +$lang->cmd_copy = 'Copy'; +$lang->cmd_move = 'Move'; +$lang->cmd_move_up = 'Up'; +$lang->cmd_move_down = 'Down'; +$lang->cmd_add_indent = 'Indent'; +$lang->cmd_remove_indent = 'Outdent'; +$lang->cmd_management = 'Manage'; +$lang->cmd_make = 'Create'; +$lang->cmd_select = 'Select'; +$lang->cmd_select_all = 'Select All'; +$lang->cmd_unselect_all = 'Deselect All'; +$lang->cmd_reverse_all = 'Reverse'; +$lang->cmd_close_all = 'Close All'; +$lang->cmd_open_all = 'Open All'; +$lang->cmd_reload = 'Reload'; +$lang->cmd_close = 'Close'; +$lang->cmd_open = 'Open'; +$lang->cmd_setup = 'Configure'; +$lang->cmd_addition_setup = 'Additional Setup'; +$lang->cmd_option = 'Option'; +$lang->cmd_apply = 'Apply'; +$lang->cmd_open_calendar = 'Select a Date'; +$lang->cmd_send = 'Send'; +$lang->cmd_print = 'Print'; +$lang->cmd_scrap = 'Scrap'; +$lang->cmd_preview = 'Preview'; +$lang->cmd_reset = 'Reset'; +$lang->cmd_remake_cache = "Re-create cache file"; +$lang->cmd_publish = "Publish"; +$lang->cmd_layout_setup = 'Configure layout'; +$lang->cmd_layout_edit = 'Edit layout'; +$lang->cmd_search_by_ipaddress = 'Search by IP Address'; +$lang->cmd_add_ip_to_spamfilter = 'Add IP to spamfilter'; + +$lang->enable = 'Enable'; +$lang->disable = 'Disable'; + +// Essential Words +$lang->menu = 'Menu'; +$lang->no = 'No.'; +$lang->notice = 'Notice'; +$lang->secret = 'Secret'; +$lang->category = $lang->category_srl = 'Category'; +$lang->none_category = 'None category'; +$lang->none_image = 'Image does not exist'; +$lang->document_srl = 'Doc. No.'; +$lang->user_id = 'User ID'; +$lang->author = 'Developer'; +$lang->password = 'Password'; +$lang->password1 = 'Password'; +$lang->password2 = 'Retype Password'; +$lang->admin_id = 'Admin ID'; +$lang->writer = 'Author'; +$lang->user_name = 'User Name'; +$lang->nick_name = 'Nick Name'; +$lang->email_address = 'Email'; +$lang->homepage = 'Homepage'; +$lang->blog = 'Blog'; +$lang->birthday = 'Birthday'; +$lang->browser_title = 'Browser Title'; +$lang->title = 'Subject'; +$lang->title_content = 'Subject+Content'; +$lang->topic = 'Topic'; +$lang->replies = 'Reply'; +$lang->content = 'Content'; +$lang->document = 'Article'; +$lang->comment = 'Comment'; +$lang->description = 'Description'; +$lang->trackback = 'Trackback'; +$lang->tag = 'Tag'; +$lang->allow_comment = 'Allow Comments'; +$lang->lock_comment = 'Block Comments'; +$lang->allow_trackback = 'Allow Trackbacks'; +$lang->uploaded_file = 'Attachment'; +$lang->grant = 'Permission'; +$lang->target = 'Target'; +$lang->total = 'Total'; +$lang->total_count = 'Count Total'; +$lang->ipaddress = 'IP Address'; +$lang->path = 'Path'; +$lang->cart = 'Selected Item'; +$lang->friend = 'Friends'; +$lang->notify = 'Notification'; +$lang->order_target = 'Align Target'; +$lang->order_type = 'Sorting Type'; +$lang->order_asc = 'ascend'; +$lang->order_desc = 'descend'; +$lang->file = 'file'; + +$lang->mid = 'Module Name'; +$lang->sid = 'Site Name'; +$lang->layout = 'Layout'; +$lang->mobile_layout = 'Mobile Layout'; +$lang->widget = 'Widget'; +$lang->module = 'Module'; +$lang->skin = 'Theme'; +$lang->mobile_skin = 'Mobile Theme'; +$lang->colorset = 'Colorset'; +$lang->extra_vars = 'Extra Vars'; + +$lang->domain = "Domain Name"; +$lang->url = "URL"; +$lang->document_url = 'Article URL'; +$lang->trackback_url = 'Trackback URL'; +$lang->blog_name = 'Blog Title'; +$lang->excerpt = 'Quotation'; + +$lang->document_count = 'Total Articles'; +$lang->page_count = 'Page Count'; +$lang->list_count = 'List Count'; +$lang->search_list_count = 'Search List Count'; +$lang->readed_count = 'Views'; +$lang->voted_count = 'Votes'; +$lang->comment_count = 'Comments'; +$lang->member_count = 'Member Count'; +$lang->date = 'Date'; +$lang->regdate = 'Registered Date'; +$lang->last_update = 'Last Update'; +$lang->last_post = 'Last Post'; +$lang->signup_date = 'Sign up Date'; +$lang->last_login = 'Last Sign in'; +$lang->first_page = 'First Page'; +$lang->last_page = 'Last Page'; +$lang->search_target = 'Target for Search'; +$lang->search_keyword = 'Keyword'; +$lang->is_default = 'Default'; + +$lang->no_documents = 'No Articles'; + +$lang->board_manager = 'Board Settings'; +$lang->member_manager = 'Member Settings'; +$lang->layout_manager = 'Layout Settings'; + +$lang->use = 'Use'; +$lang->notuse = 'Not use'; +$lang->not_exists = "Doesn't exist"; + +$lang->public = 'public'; +$lang->private = 'private'; + +$lang->unit_sec = 'sec'; +$lang->unit_min = 'min'; +$lang->unit_hour = 'hr'; +$lang->unit_day = 'th'; +$lang->unit_month = 'month'; +$lang->unit_year = 'year'; + +$lang->unit_week = array( + 'Monday' => 'Monday', + 'Tuesday' => 'Tuesday', + 'Wednesday' => 'Wednesday', + 'Thursday' => 'Thursday', + 'Friday' => 'Friday', + 'Saturday' => 'Saturday', + 'Sunday' => 'Sunday', +); + +$lang->unit_meridiem = array( + 'am' => 'am', + 'pm' => 'pm', + 'AM' => 'AM', + 'PM' => 'PM', +); + +$lang->time_gap = array( + 'min' => '%d minute ago', + 'mins' => '%d minutes ago', + 'hour' => '%d hour ago', + 'hours' => '%d hours ago', +); + +// Descriptions +$lang->about_tag = 'You may submit multiple tags by inserting commas(,) between each tag'; +$lang->about_layout = 'Layouts decorate the appearance of your modules. you can configure them from Layout menu on the top'; + +// Messages +$lang->msg_call_server = 'Requesting to the server, please wait'; +$lang->msg_db_not_setted = 'DB configuration has not been set'; +$lang->msg_dbconnect_failed = "Error has occurred while connecting DB.\nPlease check DB information again"; +$lang->msg_invalid_queryid = 'Specified query ID value is invalid'; +$lang->msg_not_permitted = 'You do not have permission to access'; +$lang->msg_input_password = 'Please input the password'; +$lang->msg_invalid_document = 'Invalid Article Number'; +$lang->msg_invalid_request = 'Invalid Request'; +$lang->msg_invalid_password = 'Invalid Password'; +$lang->msg_error_occured = 'An error has occured'; +$lang->msg_not_founded = 'Target could not be found'; +$lang->msg_no_result = 'Nothing found'; +$lang->msg_fail_to_request_open = 'Fail to open your request'; +$lang->msg_invalid_format = 'Invalid Format'; + +$lang->msg_not_permitted_act = 'You do not have permission to execute requested action'; +$lang->msg_module_does_not_exist = "Couldn't find the requested module.\nPlease contact the administrator."; +$lang->msg_module_is_not_standalone = 'Requested module cannot be executed independently'; +$lang->msg_default_url_is_not_defined = 'Default URL is not defined'; + +$lang->success_registed = 'Registered successfully'; +$lang->success_declared = 'Accused successfully'; +$lang->success_updated = 'Updated successfully'; +$lang->success_deleted = 'Deleted successfully'; +$lang->success_voted = 'Recommended successfully'; +$lang->success_blamed = 'Blamed successfully'; +$lang->success_moved = 'Moved successfully'; +$lang->success_sended = 'Sent successfully'; +$lang->success_reset = 'Reset successfully'; +$lang->success_leaved = 'All member data have been deleted completely.'; +$lang->success_saved = 'Saved successfully'; + +$lang->fail_to_delete = 'Could not be deleted'; +$lang->fail_to_move = 'Could not be moved'; + +$lang->failed_voted = 'Could not recommend'; +$lang->failed_blamed = 'Could not blame'; +$lang->failed_declared = 'Could not accuse'; +$lang->fail_to_delete_have_children = 'Please try again after removing replies first'; + +$lang->confirm_submit = 'Are you sure to submit?'; +$lang->confirm_logout = 'Are you sure to logout?'; +$lang->confirm_vote = 'Are you sure to recommend?'; +$lang->confirm_delete = 'Are you sure to delete?'; +$lang->confirm_move = 'Are you sure to move?'; +$lang->confirm_reset = 'Are you sure to reset?'; +$lang->confirm_leave = 'Are you sure to leave?'; +$lang->confirm_update = 'Are you sure to update?'; + +$lang->column_type = 'Column Type'; +$lang->column_type_list['text'] = 'one-line text'; +$lang->column_type_list['homepage'] = 'url'; +$lang->column_type_list['email_address'] = 'email'; +$lang->column_type_list['tel'] = 'phone number'; +$lang->column_type_list['textarea'] = 'multi-line textarea'; +$lang->column_type_list['checkbox'] = 'checkbox (multiple selection)'; +$lang->column_type_list['select'] = 'select box (single selection)'; +$lang->column_type_list['radio'] = 'radio button (radio)'; +$lang->column_type_list['kr_zip'] = 'zip code (Korean)'; +$lang->column_type_list['date'] = 'date (yyyy/mm/dd)'; +//$lang->column_type_list['jp_zip'] = 'zip code (Japanese)'; +$lang->column_name = 'Column Name'; +$lang->column_title = 'Column Title'; +$lang->default_value = 'Default Value'; +$lang->is_active = 'Active'; +$lang->is_required = 'Required Field'; +$lang->eid = 'Name of extra variable'; + +// ftp-related +$lang->ftp_form_title = 'FTP Account Information'; +$lang->ftp = 'FTP'; +$lang->ftp_host = 'FTP hostname'; +$lang->ftp_port = 'FTP port'; +$lang->about_ftp_password = 'FTP password will not be stored'; +$lang->cmd_check_ftp_connect = 'Check FTP Connection'; +$lang->about_ftp_info = " + FTP account information can be used in following cases.
+ 1. If safe_mode setting of PHP is on, XE will be installed using FTP.
+ 2. Automatic updates might use FTP information.
+ This account info will be stored in files/config/ftp.config.php
+ After installation, you can modify or delete the account info at the administration page.
+"; + +$lang->msg_safe_mode_ftp_needed = "If safe_mode setting of PHP is on, you should input FTP account information to install XE."; +$lang->msg_ftp_not_connected = "Connection to localhost via FTP failed. Please check the port number and if FTP service is available."; +$lang->msg_ftp_invalid_auth_info = "Authentication failed. Please check the username and password."; +$lang->msg_ftp_mkdir_fail = "Directory creation failed. Please check the permission of FTP account."; +$lang->msg_ftp_chmod_fail = "Chmod failed. Please check the permission and configuration of FTP server."; +$lang->msg_ftp_connect_success = "Connection and authentication to the FTP server succeeded."; + +$lang->ftp_path_title = 'FTP Path Information'; +$lang->msg_ftp_installed_realpath = 'Absolute Path of XE'; +$lang->msg_ftp_installed_ftp_realpath = 'Absolute FTP Path of XE'; + +// Alert messages for Javascript using by XML filter +$lang->filter->isnull = 'Please input a value for %s'; +$lang->filter->outofrange = 'Please align the text length of %s'; +$lang->filter->equalto = "The value of %s is invalid"; +$lang->filter->invalid_email = "The format of %s is invalid. ex) developers@xpressengine.com"; +$lang->filter->invalid_user_id = $lang->filter->invalid_userid = "The format of %s is invalid.\\nAll values should consist of alphabets, numbers or underscore(_) and the first letter should be alphabet"; +$lang->filter->invalid_homepage = "The format of %s is invalid. ex) http://xpressengine.com/"; +$lang->filter->invalid_korean = "The format of %s is invalid. Please input Korean only"; +$lang->filter->invalid_korean_number = "The format of %s is invalid. Please input Korean or numbers"; +$lang->filter->invalid_alpha = "The format of %s is invalid. Please input alphabets only"; +$lang->filter->invalid_alpha_number = "The format of %s is invalid. Please input alphabets or numbers"; +$lang->filter->invalid_number = "The format of %s is invalid. Please input numbers only"; + +$lang->security_warning_embed = "Due to security concern, administrators are not allowed to view embedded items.
To view them, please use another non-administrator ID."; +$lang->msg_pc_to_mobile = '이 페이지는 모바일 보기가 있습니다. 모바일 보기로 이동하시겠습니까?'; +?> \ No newline at end of file diff --git a/test-phpUnit/classes/xml/xmlquery/tags/condition/ConditionTagTest.php b/test-phpUnit/classes/xml/xmlquery/tags/condition/ConditionTagTest.php index fe8d84f44..02ce85348 100644 --- a/test-phpUnit/classes/xml/xmlquery/tags/condition/ConditionTagTest.php +++ b/test-phpUnit/classes/xml/xmlquery/tags/condition/ConditionTagTest.php @@ -21,7 +21,7 @@ class ConditionTagTest extends CubridTest { $tag = new ConditionTag($xml_obj->condition); $arguments = $tag->getArguments(); - $expected = "new Condition('\"user_id\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\")"; + $expected = "new ConditionWithArgument('\"user_id\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\")"; $actual = $tag->getConditionString(); $this->assertEquals($expected, $actual); @@ -38,7 +38,7 @@ class ConditionTagTest extends CubridTest { $xml_obj = Helper::getXmlObject($xml_file); $tag = new ConditionTag($xml_obj->condition); - $expected = "new Condition('\"comments\".\"user_id\"','\"member\".\"user_id\"',\"equal\")"; + $expected = "new ConditionWithoutArgument('\"comments\".\"user_id\"','\"member\".\"user_id\"',\"equal\")"; $actual = $tag->getConditionString(); $this->assertEquals($expected, $actual); @@ -57,7 +57,7 @@ class ConditionTagTest extends CubridTest { $tag = new ConditionTag($xml_obj->condition); $arguments = $tag->getArguments(); - $expected = "new Condition('\"type\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\", 'and')"; + $expected = "new ConditionWithArgument('\"type\"',\$" . $arguments[0]->getArgumentName() . "_argument,\"equal\", 'and')"; $actual = $tag->getConditionString(); $this->assertEquals($expected, $actual); @@ -74,7 +74,7 @@ class ConditionTagTest extends CubridTest { $xml_obj = Helper::getXmlObject($xml_file); $tag = new ConditionTag($xml_obj->condition); - $expected = "new Condition('\"modules\".\"module_srl\"','\"documents\".\"module_srl\"',\"equal\", 'and')"; + $expected = "new ConditionWithoutArgument('\"modules\".\"module_srl\"','\"documents\".\"module_srl\"',\"equal\", 'and')"; $actual = $tag->getConditionString(); $this->assertEquals($expected, $actual); diff --git a/test-phpUnit/classes/xml/xmlquery/tags/table/TableTagTest.php b/test-phpUnit/classes/xml/xmlquery/tags/table/TableTagTest.php index 1e7c86d74..07e667f35 100644 --- a/test-phpUnit/classes/xml/xmlquery/tags/table/TableTagTest.php +++ b/test-phpUnit/classes/xml/xmlquery/tags/table/TableTagTest.php @@ -1,17 +1,17 @@ xmlPath = str_replace('TableTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; } - + /** * Tests a simple tag: *
@@ -20,12 +20,12 @@ $xml_file = $this->xmlPath . "table_name.xml"; $xml_obj = Helper::getXmlObject($xml_file); $tag = new TableTag($xml_obj->table); - + $expected = "new Table('\"xe_modules\"', '\"modules\"')"; $actual = $tag->getTableString(); $this->assertEquals($expected, $actual); - } - + } + /** * Tests a
tag with name and alias *
@@ -33,14 +33,14 @@ function testTableTagWithNameAndAlias(){ $xml_file = $this->xmlPath . "table_name_alias.xml"; $xml_obj = Helper::getXmlObject($xml_file); - + $tag = new TableTag($xml_obj->table); - + $expected = "new Table('\"xe_modules\"', '\"mod\"')"; $actual = $tag->getTableString(); $this->assertEquals($expected, $actual); - } - + } + /** * Tests a
tag used for joins *
@@ -48,27 +48,27 @@ * * *
- * + * */ function testTableTagWithJoinCondition(){ $xml_file = $this->xmlPath . "table_name_alias_type.xml"; $xml_obj = Helper::getXmlObject($xml_file); - + $tag = new TableTag($xml_obj->table); - + $actual = $tag->getTableString(); $expected = 'new JoinTable(\'"xe_module_categories"\', \'"module_categories"\', "left join", array( new ConditionGroup(array( - new Condition(\'"module_categories"."module_category_srl"\',\'"modules"."module_category_srl"\',"equal") + new ConditionWithoutArgument(\'"module_categories"."module_category_srl"\',\'"modules"."module_category_srl"\',"equal") )) ))'; $actual = Helper::cleanString($actual); $expected = Helper::cleanString($expected); - + $this->assertEquals($expected, $actual); - } - + } + /** * If a table tag has the type attribute and condition children * it means it is meant to be used inside a join @@ -78,22 +78,22 @@ $xml_obj = Helper::getXmlObject($xml_file); $tag = new TableTag($xml_obj->table); - + $this->assertEquals(true, $tag->isJoinTable()); } - + /** * Tests that a simple table tag is not a join table */ - function testTagWithoutTypeIsNotJoinTable(){ + function testTagWithoutTypeIsNotJoinTable(){ $xml_file = $this->xmlPath . "table_name_alias.xml"; $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TableTag($xml_obj->table); - + $tag = new TableTag($xml_obj->table); + $this->assertEquals(false, $tag->isJoinTable()); - } - + } + /** * If no alias is specified, test that table name is used */ @@ -101,9 +101,9 @@ $xml_file = $this->xmlPath . "table_name.xml"; $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("modules", $tag->getTableAlias()); + $tag = new TableTag($xml_obj->table); + + $this->assertEquals("modules", $tag->getTableAlias()); } /** @@ -113,11 +113,11 @@ $xml_file = $this->xmlPath . "table_name_alias.xml"; $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("mod", $tag->getTableAlias()); - } - + $tag = new TableTag($xml_obj->table); + + $this->assertEquals("mod", $tag->getTableAlias()); + } + /** * Table name propery should returned unescaped and unprefixed table name * (The one in the XML file) @@ -126,9 +126,9 @@ $xml_file = $this->xmlPath . "table_name_alias.xml"; $xml_obj = Helper::getXmlObject($xml_file); - $tag = new TableTag($xml_obj->table); - - $this->assertEquals("modules", $tag->getTableName()); - } - + $tag = new TableTag($xml_obj->table); + + $this->assertEquals("modules", $tag->getTableName()); + } + } \ No newline at end of file diff --git a/test-phpUnit/classes/xml/xmlquery/tags/table/TablesTagTest.php b/test-phpUnit/classes/xml/xmlquery/tags/table/TablesTagTest.php index 5181cafbd..d9ae1441d 100644 --- a/test-phpUnit/classes/xml/xmlquery/tags/table/TablesTagTest.php +++ b/test-phpUnit/classes/xml/xmlquery/tags/table/TablesTagTest.php @@ -1,17 +1,17 @@ xmlPath = str_replace('TablesTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; } - + /** * Tests a simple tag: * @@ -22,13 +22,13 @@ $xml_file = $this->xmlPath . "tables_one_table.xml"; $xml_obj = Helper::getXmlObject($xml_file); $tag = new TablesTag($xml_obj->tables); - + $expected = "array(new Table('\"xe_member\"', '\"member\"'))"; $actual = $tag->toString(); - + $this->_testCachedOutput($expected, $actual); - } - + } + /** * Tests a simple tag: * @@ -40,16 +40,16 @@ $xml_file = $this->xmlPath . "tables_two_tables_no_join.xml"; $xml_obj = Helper::getXmlObject($xml_file); $tag = new TablesTag($xml_obj->tables); - + $expected = "array( - new Table('\"xe_member_group\"', '\"a\"') + new Table('\"xe_member_group\"', '\"a\"') ,new Table('\"xe_member_group_member\"', '\"b\"') )"; $actual = $tag->toString(); - + $this->_testCachedOutput($expected, $actual); - } - + } + /** * Tests a simple tag: * @@ -65,16 +65,16 @@ $xml_file = $this->xmlPath . "tables_two_tables_with_join.xml"; $xml_obj = Helper::getXmlObject($xml_file); $tag = new TablesTag($xml_obj->tables); - + $expected = "array( - new Table('\"xe_files\"', '\"files\"') + new Table('\"xe_files\"', '\"files\"') ,new JoinTable('\"xe_member\"' , '\"member\"' , \"left join\" , array( new ConditionGroup( array( - new Condition( + new ConditionWithoutArgument( '\"files\".\"member_srl\"' ,'\"member\".\"member_srl\"' ,\"equal\" @@ -85,10 +85,10 @@ ) )"; $actual = $tag->toString(); - + $this->_testCachedOutput($expected, $actual); - } - + } + /** * Tests a simple tag: * @@ -104,11 +104,11 @@ $xml_file = $this->xmlPath . "tables_two_tables_with_join.xml"; $xml_obj = Helper::getXmlObject($xml_file); $tag = new TablesTag($xml_obj->tables); - + $tables = $tag->getTables(); - + $this->assertEquals(2, count($tables)); $this->assertTrue(is_a($tables[0], 'TableTag')); $this->assertTrue(is_a($tables[1], 'TableTag')); - } + } } \ No newline at end of file diff --git a/test-phpUnit/db/CubridOnlineTest.php b/test-phpUnit/db/CubridOnlineTest.php index 08037d02d..8c368df4c 100644 --- a/test-phpUnit/db/CubridOnlineTest.php +++ b/test-phpUnit/db/CubridOnlineTest.php @@ -14,6 +14,7 @@ * Prepare runtime context - tell DB class that current DB is CUBRID */ protected function setUp() { + $this->markTestSkipped(); $oContext = &Context::getInstance(); $db_info->master_db = array('db_type' => 'cubrid' diff --git a/test-phpUnit/db/MssqlOnlineTest.php b/test-phpUnit/db/MssqlOnlineTest.php index 07f356aa0..54d9fa7a9 100644 --- a/test-phpUnit/db/MssqlOnlineTest.php +++ b/test-phpUnit/db/MssqlOnlineTest.php @@ -14,6 +14,7 @@ * Prepare runtime context - tell DB class that current DB is MSSQL */ protected function setUp() { + $this->markTestSkipped(); $oContext = &Context::getInstance(); $db_info->master_db = array('db_type' => 'mssql' diff --git a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php index 44514a630..05d3f367f 100644 --- a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php +++ b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php @@ -128,7 +128,7 @@ } function test_opage_getOpageList(){ - $xml_file = _XE_PATH_ . "modules/opage/queries/getOpageList.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/opage.getOpageList.xml"; $argsString = '$args->s_title = "yuhuu"; $args->module = \'opage\';'; $expected = 'SELECT * @@ -140,7 +140,7 @@ } function test_syndication_getGrantedModules(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getGrantedModules.xml"; $argsString = '$args->module_srl = 12; $args->name = array(\'access\',\'view\',\'list\');'; $expected = 'select "module_srl" @@ -219,7 +219,7 @@ * Query argument is a single value - not in (12) */ function test_module_getModules_Notin_Single_Value(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->except_module_srls = 12;'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -239,7 +239,7 @@ } function test_module_getModules_Notin_Multiple_Value_String(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->except_module_srls = "12, 13, 14";'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -259,7 +259,7 @@ } function test_module_getModules_Notin_Multiple_Value_Array(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->except_module_srls = array(12, 13, 14);'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -279,7 +279,7 @@ } function test_module_getModules_In_Single_Value(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->module_srls = 12;'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -299,7 +299,7 @@ } function test_module_getModules_In_Multiple_Value_String(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->module_srls = "12, 13, 14";'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -319,7 +319,7 @@ } function test_module_getModules_In_Multiple_Value_Array(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/cubrid/data/syndication.getModules.xml"; $argsString = '$args->module_srls = array(12, 13, 14);'; $expected = 'select "modules"."site_srl" as "site_srl" , "modules"."module_srl" as "module_srl" @@ -390,7 +390,7 @@ $argsString = ''; $expected = 'select "session_key" from "xe_session" as "session" - where "expired" <= ' . date("YmdHis"); + where "expired" <= \'' . date("YmdHis") . '\''; $this->_test($xml_file, $argsString, $expected); } diff --git a/test-phpUnit/db/xml_query/cubrid/data/opage.getOpageList.xml b/test-phpUnit/db/xml_query/cubrid/data/opage.getOpageList.xml new file mode 100644 index 000000000..2e7964335 --- /dev/null +++ b/test-phpUnit/db/xml_query/cubrid/data/opage.getOpageList.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-phpUnit/db/xml_query/cubrid/data/syndication.getGrantedModules.xml b/test-phpUnit/db/xml_query/cubrid/data/syndication.getGrantedModules.xml new file mode 100644 index 000000000..97d2b4ec9 --- /dev/null +++ b/test-phpUnit/db/xml_query/cubrid/data/syndication.getGrantedModules.xml @@ -0,0 +1,19 @@ + + +
+ + + + + + + + + + + + + + + + diff --git a/test-phpUnit/db/xml_query/cubrid/data/syndication.getModules.xml b/test-phpUnit/db/xml_query/cubrid/data/syndication.getModules.xml new file mode 100644 index 000000000..fbbe83ad9 --- /dev/null +++ b/test-phpUnit/db/xml_query/cubrid/data/syndication.getModules.xml @@ -0,0 +1,26 @@ + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + +
diff --git a/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php b/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php index c33e4661e..ae7867bda 100644 --- a/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php +++ b/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php @@ -132,7 +132,7 @@ * in xe_modules. Maybe the developer ment "browser_title" */ function test_opage_getOpageList(){ - $xml_file = _XE_PATH_ . "modules/opage/queries/getOpageList.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/mssql/data/opage.getOpageList.xml"; $argsString = '$args->s_title = "yuhuu"; $args->module = \'opage\';'; $expected = 'SELECT TOP 20 * @@ -157,7 +157,7 @@ } function test_syndication_getGrantedModule(){ - $xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModule.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/mssql/data/syndication.getGrantedModule.xml"; $argsString = '$args->module_srl = 67;'; $expected = 'select count(*) as [count] from [xe_module_grants] as [module_grants] diff --git a/test-phpUnit/db/xml_query/mssql/data/opage.getOpageList.xml b/test-phpUnit/db/xml_query/mssql/data/opage.getOpageList.xml new file mode 100644 index 000000000..2e7964335 --- /dev/null +++ b/test-phpUnit/db/xml_query/mssql/data/opage.getOpageList.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-phpUnit/db/xml_query/mssql/data/syndication.getGrantedModule.xml b/test-phpUnit/db/xml_query/mssql/data/syndication.getGrantedModule.xml new file mode 100644 index 000000000..9a2f20e29 --- /dev/null +++ b/test-phpUnit/db/xml_query/mssql/data/syndication.getGrantedModule.xml @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + + + + + + diff --git a/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php b/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php index 441cd2fef..02e2f2225 100644 --- a/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php +++ b/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php @@ -8,7 +8,7 @@ } function testConditionWithVarAndColumnDefaultValue_WithoutArgument(){ - $xml_file = _XE_PATH_ . "modules/resource/queries/getLatestItem.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItem.xml"; $argsString = '$args->item_srl = "";'; $expected = 'select `package`.`module_srl` as `module_srl` , `package`.`status` as `status` @@ -45,7 +45,7 @@ } function testConditionWithVarAndColumnDefaultValue_WithArgument(){ - $xml_file = _XE_PATH_ . "modules/resource/queries/getLatestItem.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItem.xml"; $argsString = '$args->item_srl = "10";'; $expected = 'select `package`.`module_srl` as `module_srl` , `package`.`status` as `status` @@ -89,7 +89,7 @@ } function testResource_getLatestItemList(){ - $xml_file = _XE_PATH_ . "modules/resource/queries/getLatestItemList.xml"; + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/resource.getLatestItemList.xml"; $argsString = ''; $expected = 'select `package`.`module_srl` as `module_srl` , `package`.`status` as `status` diff --git a/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItem.xml b/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItem.xml new file mode 100644 index 000000000..f6fa06e83 --- /dev/null +++ b/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItem.xml @@ -0,0 +1,40 @@ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItemList.xml b/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItemList.xml new file mode 100644 index 000000000..041e30694 --- /dev/null +++ b/test-phpUnit/db/xml_query/mysql/data/resource.getLatestItemList.xml @@ -0,0 +1,60 @@ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +