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:
ucorina 2011-11-01 15:43:44 +00:00
parent 3928e8ec37
commit ad7dda9b75
19 changed files with 646 additions and 113 deletions

View file

@ -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);
}

View file

@ -0,0 +1,24 @@
<query id="getOpageList" action="select">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module" default="opage" />
<group pipe="and">
<condition operation="like" column="mid" var="s_mid" pipe="or" />
<condition operation="like" column="title" var="s_title" pipe="or" />
<condition operation="like" column="comment" var="s_comment" pipe="or" />
<condition operation="equal" column="module" var="s_module" pipe="or" />
<condition operation="equal" column="module_category_srl" var="s_module_category_srl" pipe="or" />
</group>
</conditions>
<navigation>
<index var="sort_index" default="module_srl" order="desc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,19 @@
<query id="getGrantedModules" action="select">
<tables>
<table name="module_grants" />
</tables>
<columns>
<column name="module_srl" />
</columns>
<conditions>
<condition operation="in" column="name" default="'access','view','list'" notnull="notnull" />
<group pipe="and">
<condition operation="more" column="group_srl" default="1" notnull="notnull" />
<condition operation="equal" column="group_srl" default="-1" notnull="notnull" pipe="or" />
<condition operation="equal" column="group_srl" default="-2" notnull="notnull" pipe="or" />
</group>
</conditions>
<groups>
<group column="module_srl" />
</groups>
</query>

View file

@ -0,0 +1,26 @@
<query id="getModules" action="select">
<tables>
<table name="sites" />
<table name="modules" />
<table name="syndication_except_modules" alias="except_modules" type="left join">
<conditions>
<condition operation="equal" column="modules.module_srl" default="except_modules.module_srl" />
</conditions>
</table>
</tables>
<columns>
<column name="modules.site_srl" alias="site_srl" />
<column name="modules.module_srl" alias="module_srl" />
<column name="sites.domain" alias="domain" />
<column name="modules.mid" alias="mid" />
<column name="modules.module" alias="module" />
<column name="modules.browser_title" alias="browser_title" />
<column name="modules.description" alias="description" />
</columns>
<conditions>
<condition operation="in" column="modules.module_srl" var="module_srls" />
<condition operation="notin" column="modules.module_srl" var="except_module_srls" pipe="and" />
<condition operation="equal" column="sites.site_srl" default="modules.site_srl" notnull="notnull" pipe="and" />
<condition operation="null" column="except_modules.module_srl" default="1" pipe="and" />
</conditions>
</query>