mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 09:19:57 +09:00
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
This commit is contained in:
parent
3928e8ec37
commit
ad7dda9b75
19 changed files with 646 additions and 113 deletions
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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().
|
||||
*/
|
||||
|
|
|
|||
322
test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php
Normal file
322
test-phpUnit/classes/xml/xmlquery/argument/data/en.lang.php
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
<?php
|
||||
/**
|
||||
* @file common/lang/en.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief English Language Pack (Only basic words are included here)
|
||||
**/
|
||||
|
||||
// words for action, which is basically used
|
||||
$lang->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. <br />
|
||||
1. If safe_mode setting of PHP is on, XE will be installed using FTP. <br />
|
||||
2. Automatic updates might use FTP information. <br />
|
||||
This account info will be stored in files/config/ftp.config.php <br />
|
||||
After installation, you can modify or delete the account info at the administration page. <br />
|
||||
";
|
||||
|
||||
$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.<BR /> To view them, please use another non-administrator ID.";
|
||||
$lang->msg_pc_to_mobile = '이 페이지는 모바일 보기가 있습니다. 모바일 보기로 이동하시겠습니까?';
|
||||
?>
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* Test class for TableTag.
|
||||
*/
|
||||
class TableTagTest extends CubridTest {
|
||||
|
||||
|
||||
var $xmlPath = "data/";
|
||||
|
||||
|
||||
function TableTagTest(){
|
||||
$this->xmlPath = str_replace('TableTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests a simple <table> tag:
|
||||
* <table name="modules" />
|
||||
|
|
@ -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 <table> tag with name and alias
|
||||
* <table name="modules" alias="mod" />
|
||||
|
|
@ -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 <table> tag used for joins
|
||||
* <table name="module_categories" alias="module_categories" type="left join">
|
||||
|
|
@ -48,27 +48,27 @@
|
|||
* <condition operation="equal" column="module_categories.module_category_srl" default="modules.module_category_srl" />
|
||||
* </conditions>
|
||||
* </table>
|
||||
*
|
||||
*
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* Test class for TablesTag.
|
||||
*/
|
||||
class TablesTagTest extends CubridTest {
|
||||
|
||||
|
||||
var $xmlPath = "data/";
|
||||
|
||||
|
||||
function TablesTagTest(){
|
||||
$this->xmlPath = str_replace('TablesTagTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests a simple <tables> tag:
|
||||
* <tables>
|
||||
|
|
@ -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 <tables> tag:
|
||||
* <tables>
|
||||
|
|
@ -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 <tables> tag:
|
||||
* <tables>
|
||||
|
|
@ -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 <tables> tag:
|
||||
* <tables>
|
||||
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue