mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-24 12:52:19 +09:00
Fixed a few MSSQL bugs - related to array query arguments and increment columns.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8632 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6edd5f03a7
commit
b3c75ac4db
15 changed files with 411 additions and 276 deletions
|
|
@ -1,30 +1,32 @@
|
|||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
define('_XE_PATH_', str_replace('test-phpUnit/config/config.inc.php', '', str_replace('\\', '/', __FILE__)));
|
||||
define('_TEST_PATH_', _XE_PATH_ . 'test-phpUnit/');
|
||||
|
||||
|
||||
if(!defined('__DEBUG__')) define('__DEBUG__', 4);
|
||||
define('__ZBXE__', true);
|
||||
|
||||
|
||||
require_once(_XE_PATH_.'test-phpUnit/Helper.class.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/QueryTester.class.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/db/DBTest.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/db/CubridTest.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/db/CubridOnlineTest.php');
|
||||
|
||||
require_once(_XE_PATH_.'config/config.inc.php');
|
||||
// require_once(_XE_PATH_.'classes/object/Object.class.php');
|
||||
// require_once(_XE_PATH_.'classes/handler/Handler.class.php');
|
||||
// require_once(_XE_PATH_.'classes/context/Context.class.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/db/MssqlTest.php');
|
||||
require_once(_XE_PATH_.'test-phpUnit/db/MssqlOnlineTest.php');
|
||||
|
||||
require_once(_XE_PATH_.'config/config.inc.php');
|
||||
// require_once(_XE_PATH_.'classes/object/Object.class.php');
|
||||
// require_once(_XE_PATH_.'classes/handler/Handler.class.php');
|
||||
// require_once(_XE_PATH_.'classes/context/Context.class.php');
|
||||
// require_once(_XE_PATH_.'classes/file/FileHandler.class.php');
|
||||
// require_once(_XE_PATH_.'classes/xml/XmlParser.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
require_once(_XE_PATH_.'classes/db/DB.class.php');
|
||||
require_once(_XE_PATH_.'classes/db/DBCubrid.class.php');
|
||||
require_once(_XE_PATH_.'classes/db/DBMssql.class.php');
|
||||
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/Argument.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/ConditionArgument.class.php');
|
||||
|
|
@ -42,7 +44,7 @@
|
|||
require_once(_XE_PATH_.'classes/db/queryparts/limit/Limit.class.php');
|
||||
require_once(_XE_PATH_.'classes/db/queryparts/Query.class.php');
|
||||
require_once(_XE_PATH_.'classes/db/queryparts/Subquery.class.php');
|
||||
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TableTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
protected $backupGlobals = FALSE;
|
||||
protected $backupStaticAttributes = FALSE;
|
||||
protected $preserveGlobalState = FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* Prepare runtime context - tell DB class that current DB is CUBRID
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp() {
|
||||
$oContext = &Context::getInstance();
|
||||
|
||||
$db_info->db_type = 'cubrid';
|
||||
|
|
@ -22,17 +22,12 @@
|
|||
$db_info->db_userid = 'dba';
|
||||
$db_info->db_password = 'arniarules';
|
||||
$db_info->db_database = 'xe15QA';
|
||||
$db_info->db_table_prefix = 'xe';
|
||||
$db_info->db_table_prefix = 'xe';
|
||||
|
||||
$oContext->setDbInfo($db_info);
|
||||
|
||||
$oContext->setDbInfo($db_info);
|
||||
|
||||
// remove cache dir
|
||||
$tmp_cache_list = FileHandler::readDir('./files','/(^cache_[0-9]+)/');
|
||||
if($tmp_cache_list){
|
||||
foreach($tmp_cache_list as $tmp_dir){
|
||||
if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir);
|
||||
}
|
||||
}
|
||||
FileHandler::removeDir( _XE_PATH_ . 'files/cache');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,6 +36,6 @@
|
|||
protected function tearDown() {
|
||||
unset($GLOBALS['__DB__']);
|
||||
XmlQueryParser::setDBParser(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
class DBTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
|
||||
function _testQuery($xml_file, $argsString, $expected, $methodName, $columnList = null){
|
||||
echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL;
|
||||
echo $xml_file;
|
||||
echo PHP_EOL . ' ----------------------------------- ' .PHP_EOL;
|
||||
|
||||
|
||||
$tester = new QueryTester();
|
||||
$outputString = $tester->getNewParserOutputString($xml_file, $argsString);
|
||||
echo $outputString;
|
||||
$output = eval($outputString);
|
||||
|
||||
|
||||
if(!is_a($output, 'Query')){
|
||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||
}else {
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
$expected = Helper::cleanString($expected);
|
||||
}
|
||||
$this->assertEquals($expected, $querySql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function _testPreparedQuery($xml_file, $argsString, $expected, $methodName, $expectedArgs = NULL){
|
||||
$tester = new QueryTester();
|
||||
$outputString = $tester->getNewParserOutputString($xml_file, $argsString);
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||
}else {
|
||||
$db = &DB::getInstance();
|
||||
$querySql = $db->{$methodName}($output);
|
||||
$querySql = $db->{$methodName}($output, false);
|
||||
$queryArguments = $output->getArguments();
|
||||
|
||||
// Remove whitespaces, tabs and all
|
||||
|
|
@ -51,14 +51,14 @@
|
|||
//echo "$i: $expectedArgs[$i] vs $queryArguments[$i]->getValue()";
|
||||
$this->assertEquals($expectedArgs[$i], $queryArguments[$i]->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function _testCachedOutput($expected, $actual){
|
||||
$expected = Helper::cleanString($expected);
|
||||
$actual = Helper::cleanString($actual);
|
||||
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
41
test-phpUnit/db/MssqlOnlineTest.php
Normal file
41
test-phpUnit/db/MssqlOnlineTest.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Base class for tests for MSSQL SQL syntax
|
||||
*/
|
||||
|
||||
class MssqlOnlineTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
protected $backupGlobals = FALSE;
|
||||
protected $backupStaticAttributes = FALSE;
|
||||
protected $preserveGlobalState = FALSE;
|
||||
|
||||
/**
|
||||
* Prepare runtime context - tell DB class that current DB is CUBRID
|
||||
*/
|
||||
protected function setUp() {
|
||||
$oContext = &Context::getInstance();
|
||||
|
||||
$db_info->db_type = 'mssql';
|
||||
$db_info->db_port = '3306';
|
||||
$db_info->db_hostname = 'PHENOMII\SQL2008EXPRESS';
|
||||
$db_info->db_userid = 'dba';
|
||||
$db_info->db_password = 'arniarules';
|
||||
$db_info->db_database = 'xe-15-db';
|
||||
$db_info->db_table_prefix = 'xe';
|
||||
|
||||
$oContext->setDbInfo($db_info);
|
||||
|
||||
// remove cache dir
|
||||
FileHandler::removeDir( _XE_PATH_ . 'files/cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* Free resources - reset static DB and QueryParser
|
||||
*/
|
||||
protected function tearDown() {
|
||||
unset($GLOBALS['__DB__']);
|
||||
XmlQueryParser::setDBParser(null);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -6,10 +6,10 @@
|
|||
function _test($xml_file, $argsString, $expected){
|
||||
$this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql');
|
||||
}
|
||||
|
||||
function test_module_updateModule(){
|
||||
|
||||
function test_module_updateModule(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/updateModule.xml";
|
||||
$argsString = ' $args->module_category_srl = 0;
|
||||
$argsString = ' $args->module_category_srl = 0;
|
||||
$args->browser_title = "test";
|
||||
$args->layout_srl = 0;
|
||||
$args->mlayout_srl = 0;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
$args->use_mobile = "";
|
||||
$args->site_srl = 0;
|
||||
$args->module_srl = 47374;';
|
||||
$expected = 'UPDATE "xe_modules"
|
||||
$expected = 'UPDATE "xe_modules"
|
||||
SET "module" = \'page\'
|
||||
, "mid" = \'test\'
|
||||
, "browser_title" = \'test\'
|
||||
|
|
@ -27,47 +27,47 @@
|
|||
, "open_rss" = \'Y\'
|
||||
, "header_text" = \'\'
|
||||
, "footer_text" = \'\'
|
||||
, "use_mobile" = \'n\'
|
||||
WHERE "site_srl" = 0
|
||||
, "use_mobile" = \'n\'
|
||||
WHERE "site_srl" = 0
|
||||
AND "module_srl" = 47374';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
function test_module_updateMember(){
|
||||
function test_member_updateLastLogin(){
|
||||
$xml_file = _XE_PATH_ . "modules/member/queries/updateLastLogin.xml";
|
||||
$argsString = ' $args->member_srl = 4;
|
||||
$argsString = ' $args->member_srl = 4;
|
||||
$args->last_login = "20110607120549";';
|
||||
$expected = 'UPDATE "xe_member" SET "member_srl" = 4, "last_login" = \'20110607120549\' WHERE "member_srl" = 4';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
function test_module_updatePoint(){
|
||||
|
||||
function test_module_updatePoint(){
|
||||
$xml_file = _XE_PATH_ . "modules/point/queries/updatePoint.xml";
|
||||
$argsString = ' $args->member_srl = 4;
|
||||
$argsString = ' $args->member_srl = 4;
|
||||
$args->point = 105;';
|
||||
$expected = 'UPDATE "xe_point" SET "point" = 105 WHERE "member_srl" = 4';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
function test_module_updateCounterUnique(){
|
||||
|
||||
function test_module_updateCounterUnique(){
|
||||
$xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml";
|
||||
$argsString = '$args->regdate = 20110607;
|
||||
';
|
||||
$expected = 'UPDATE "xe_counter_status" SET "unique_visitor" = unique_visitor+1,
|
||||
"pageview" = pageview+1 WHERE "regdate" = 20110607 ';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$expected = 'UPDATE "xe_counter_status" SET "unique_visitor" = "unique_visitor" + 1,
|
||||
"pageview" = "pageview" + 1 WHERE "regdate" = 20110607 ';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
function test_module_updateMenu(){
|
||||
|
||||
function test_module_updateMenu(){
|
||||
$xml_file = _XE_PATH_ . "modules/menu/queries/updateMenu.xml";
|
||||
$argsString = '$args->menu_srl = 204;
|
||||
$args->title = "test_menu";
|
||||
';
|
||||
$expected = 'UPDATE "xe_menu" SET "title" = \'test_menu\' WHERE "menu_srl" = 204';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
// $queryTester->test_admin_deleteActionForward();
|
||||
// $queryTester->test_module_insertModule();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,28 +6,28 @@
|
|||
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
||||
$this->_testPreparedQuery($xml_file, $argsString, $expected, 'getSelectSql', $expectedArgs = NULL);
|
||||
}
|
||||
|
||||
|
||||
function testSelectStar(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml";
|
||||
$argsString = '$args->module_srl = 10;';
|
||||
$expected = 'SELECT * FROM [xe_module_admins] as [module_admins] , [xe_member] as [member] WHERE [module_srl] = ? and [member].[member_srl] = [module_admins].[member_srl]';
|
||||
$this->_test($xml_file, $argsString, $expected, array(10));
|
||||
}
|
||||
|
||||
|
||||
function testRquiredParameter(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getAdminId.xml";
|
||||
$argsString = '';
|
||||
$expected = 'Date incorecte! Query-ul nu a putut fi executat.';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
|
||||
function testWithoutCategoriesTag(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getModuleCategories.xml";
|
||||
$argsString = '';
|
||||
$expected = 'SELECT * FROM [xe_module_categories] as [module_categories] ORDER BY [title] asc';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
|
||||
function test_module_getDefaultModules(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getDefaultModules.xml";
|
||||
$argsString = '';
|
||||
|
|
@ -36,14 +36,14 @@
|
|||
, [modules].[mid]
|
||||
, [modules].[browser_title]
|
||||
, [module_categories].[title] as [category]
|
||||
, [modules].[module_srl]
|
||||
FROM [xe_modules] as [modules]
|
||||
left join [xe_module_categories] as [module_categories]
|
||||
on [module_categories].[module_category_srl] = [modules].[module_category_srl]
|
||||
WHERE [modules].[site_srl] = ?
|
||||
, [modules].[module_srl]
|
||||
FROM [xe_modules] as [modules]
|
||||
left join [xe_module_categories] as [module_categories]
|
||||
on [module_categories].[module_category_srl] = [modules].[module_category_srl]
|
||||
WHERE [modules].[site_srl] = ?
|
||||
ORDER BY [modules].[module] asc, [module_categories].[title] asc, [modules].[mid] asc';
|
||||
$this->_test($xml_file, $argsString, $expected, array(0));
|
||||
}
|
||||
$this->_test($xml_file, $argsString, $expected, array(0));
|
||||
}
|
||||
|
||||
function test_module_getSiteInfo(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getSiteInfo.xml";
|
||||
|
|
@ -72,8 +72,8 @@
|
|||
, [sites].[domain] as [domain]
|
||||
, [sites].[index_module_srl] as [index_module_srl]
|
||||
, [sites].[default_language] as [default_language]
|
||||
FROM [xe_sites] as [sites]
|
||||
left join [xe_modules] as [modules] on [modules].[module_srl] = [sites].[index_module_srl]
|
||||
FROM [xe_sites] as [sites]
|
||||
left join [xe_modules] as [modules] on [modules].[module_srl] = [sites].[index_module_srl]
|
||||
WHERE [sites].[site_srl] = ? ';
|
||||
$this->_test($xml_file, $argsString, $expected, array(0));
|
||||
}
|
||||
|
|
@ -81,77 +81,86 @@
|
|||
function test_addon_getAddonInfo(){
|
||||
$xml_file = _XE_PATH_ . "modules/addon/queries/getAddonInfo.xml";
|
||||
$argsString = '$args->addon = "captcha";';
|
||||
$expected = 'SELECT *
|
||||
$expected = 'SELECT *
|
||||
FROM [xe_addons] as [addons]
|
||||
WHERE [addon] = ? ';
|
||||
$this->_test($xml_file, $argsString, $expected, array("'captcha'"));
|
||||
}
|
||||
|
||||
|
||||
function test_addon_getAddons(){
|
||||
$xml_file = _XE_PATH_ . "modules/addon/queries/getAddons.xml";
|
||||
$argsString = '';
|
||||
$expected = 'SELECT *
|
||||
$expected = 'SELECT *
|
||||
FROM [xe_addons] as [addons]
|
||||
ORDER BY [addon] asc';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function test_admin_getCommentCount(){
|
||||
$xml_file = _XE_PATH_ . "modules/admin/queries/getCommentCount.xml";
|
||||
$argsString = '';
|
||||
$expected = 'SELECT count(*) as [count]
|
||||
$expected = 'SELECT count(*) as [count]
|
||||
FROM [xe_comments] as [comments]';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
function test_admin_getCommentDeclaredStatus(){
|
||||
$xml_file = _XE_PATH_ . "modules/admin/queries/getCommentDeclaredStatus.xml";
|
||||
$argsString = '$args->date = "20110411";';
|
||||
$expected = 'SELECT TOP 2 substr([regdate],1,8) as [date], count(*) as [count]
|
||||
$expected = 'SELECT TOP 2 substr([regdate],1,8) as [date], count(*) as [count]
|
||||
FROM [xe_comment_declared_log] as [comment_declared_log]
|
||||
WHERE [regdate] >= ?
|
||||
GROUP BY substr([regdate],1,8)
|
||||
WHERE [regdate] >= ?
|
||||
GROUP BY substr([regdate],1,8)
|
||||
ORDER BY substr([regdate],1,8) asc';
|
||||
$this->_test($xml_file, $argsString, $expected, array("'20110411'"));
|
||||
$this->_test($xml_file, $argsString, $expected, array("'20110411'"));
|
||||
}
|
||||
|
||||
|
||||
function test_member_getAutoLogin(){
|
||||
$xml_file = _XE_PATH_ . "modules/member/queries/getAutoLogin.xml";
|
||||
$argsString = '$args->autologin_key = 10;';
|
||||
$expected = 'SELECT [member].[user_id] as [user_id]
|
||||
, [member].[password] as [password]
|
||||
, [member_autologin].[autologin_key] as [autologin_key]
|
||||
FROM [xe_member] as [member] , [xe_member_autologin] as [member_autologin]
|
||||
WHERE [member_autologin].[autologin_key] = ?
|
||||
FROM [xe_member] as [member] , [xe_member_autologin] as [member_autologin]
|
||||
WHERE [member_autologin].[autologin_key] = ?
|
||||
and [member].[member_srl] = [member_autologin].[member_srl]';
|
||||
$this->_test($xml_file, $argsString, $expected, array("'10'"));
|
||||
}
|
||||
|
||||
|
||||
function test_opage_getOpageList(){
|
||||
$xml_file = _XE_PATH_ . "modules/opage/queries/getOpageList.xml";
|
||||
$argsString = '$args->s_title = "yuhuu";
|
||||
$args->module = \'opage\';';
|
||||
$expected = 'SELECT TOP 20 *
|
||||
$expected = 'SELECT TOP 20 *
|
||||
FROM [xe_modules] as [modules]
|
||||
WHERE [module] = ? and ([browser_title] like ?)
|
||||
WHERE [module] = ? and ([browser_title] like ?)
|
||||
ORDER BY [module_srl] desc';
|
||||
$this->_test($xml_file, $argsString, $expected, array("'opage'", "'%yuhuu%'"));
|
||||
$this->_test($xml_file, $argsString, $expected, array("'opage'", "'%yuhuu%'"));
|
||||
}
|
||||
|
||||
|
||||
function test_module_getExtraVars(){
|
||||
$xml_file = _XE_PATH_ . "modules/module/queries/getModuleExtraVars.xml";
|
||||
$argsString = '$args->module_srl = 25;';
|
||||
$expected = 'SELECT * FROM [xe_module_extra_vars] as [module_extra_vars] WHERE [module_srl] in (?)';
|
||||
$this->_test($xml_file, $argsString, $expected, array("25"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO Something fishy about this query - to be investigated
|
||||
/*
|
||||
function test_syndication_getGrantedModules(){
|
||||
$xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModules.xml";
|
||||
$argsString = '$args->module_srl = 12;
|
||||
$args->name = array(\'access\',\'view\',\'list\');';
|
||||
$expected = 'select "module_srl"
|
||||
from "xe_module_grants" as "module_grants"
|
||||
where "name" in (?)
|
||||
and ("group_srl" >= -2
|
||||
or "group_srl" = -2
|
||||
or "group_srl" = -2)
|
||||
$expected = 'select "module_srl"
|
||||
from "xe_module_grants" as "module_grants"
|
||||
where "name" in (?)
|
||||
and ("group_srl" >= -2
|
||||
or "group_srl" = -2
|
||||
or "group_srl" = -2)
|
||||
group by "module_srl"';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
*/
|
||||
}
|
||||
12
test-phpUnit/db/xml_query/mssql/MssqlUpdateOnlineTest.php
Normal file
12
test-phpUnit/db/xml_query/mssql/MssqlUpdateOnlineTest.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
class MssqlUpdateOnlineTest extends MssqlOnlineTest {
|
||||
|
||||
function test_counter_updateCounterUnique(){
|
||||
$args->regdate = 20110211;
|
||||
|
||||
$output = executeQuery("counter.updateCounterUnique", $args);
|
||||
$this->assertEquals(0, $output->error, $output->error + ' ' + $output->message);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
17
test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php
Normal file
17
test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||
|
||||
class MssqlUpdateTest extends MssqlTest {
|
||||
|
||||
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
||||
$this->_testPreparedQuery($xml_file, $argsString, $expected, 'getUpdateSql', $expectedArgs = NULL);
|
||||
}
|
||||
|
||||
function test_counter_updateCounterUnique(){
|
||||
$xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml";
|
||||
$argsString = '$args->regdate = 25;';
|
||||
$expected = 'UPDATE [xe_counter_status] SET [unique_visitor] = [unique_visitor] + ?, [pageview] = [pageview] + ? WHERE [regdate] = ?';
|
||||
$this->_test($xml_file, $argsString, $expected, array("25", 1, 1));
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue