diff --git a/test-phpUnit/DeleteXmlTest_Cubrid.php b/test-phpUnit/DeleteXmlTest_Cubrid.php index da146978a..d73537bd0 100644 --- a/test-phpUnit/DeleteXmlTest_Cubrid.php +++ b/test-phpUnit/DeleteXmlTest_Cubrid.php @@ -5,13 +5,14 @@ function _test($xml_file, $argsString, $expected){ $tester = new QueryTester(); - $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString); + $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid'); $output = eval($outputString); if(!is_a($output, 'Query')){ if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; }else { - $db = new DBCubrid(); + //$db = new DBCubrid(); + $db = &DB::getInstance('cubrid'); $querySql = $db->getDeleteSql($output); // Remove whitespaces, tabs and all diff --git a/test-phpUnit/InsertXmlTest_Cubrid.php b/test-phpUnit/InsertXmlTest_Cubrid.php index c61eca9bb..eba6bb9b3 100644 --- a/test-phpUnit/InsertXmlTest_Cubrid.php +++ b/test-phpUnit/InsertXmlTest_Cubrid.php @@ -5,14 +5,14 @@ function _test($xml_file, $argsString, $expected){ $tester = new QueryTester(); - echo $xml_file . $argsString; - $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString); + $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid'); $output = eval($outputString); if(!is_a($output, 'Query')){ if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; }else { - $db = new DBCubrid(); + //$db = new DBCubrid(); + $db = &DB::getInstance('cubrid'); $querySql = $db->getInsertSql($output); // Remove whitespaces, tabs and all @@ -62,9 +62,81 @@ , \'n\')'; $this->_test($xml_file, $argsString, $expected); } - + function test_module_insertSiteTodayStatus(){ + //\''.date("YmdHis").'\' + $xml_file = _XE_PATH_ . "modules/counter/queries/insertTodayStatus.xml"; + $argsString = ' $args->regdate = 0; + $args->unique_visitor = 0; + $args->pageview = 0;'; + $expected = 'insert into "xe_counter_status" + ("regdate" + , "unique_visitor" + , "pageview") + values + (0 + , 0 + , 0)'; + $this->_test($xml_file, $argsString, $expected); + } + + function test_module_insertCounterLog(){ + $xml_file = _XE_PATH_ . "modules/counter/queries/insertCounterLog.xml"; + $argsString = ' $args->site_srl = 0; + $args->regdate = "20110607120619"; + $args->ipaddress = "127.0.0.1"; + $args->user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24";'; + $expected = 'insert into "xe_counter_log" + ("site_srl", "regdate", "ipaddress", "user_agent") + VALUES (0, \'20110607120619\', \'127.0.0.1\', \'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Safari/534.24\') + '; + $this->_test($xml_file, $argsString, $expected); + } + + function test_module_insertMember(){ + $xml_file = _XE_PATH_ . "modules/member/queries/insertMember.xml"; + $argsString = ' $args->member_srl = 203; + $args->user_id = "cacao"; + $args->email_address = "teta@ar.ro"; + $args->password = "23e5484cb88f3c07bcce2920a5e6a2a7"; + $args->email_id = "teta"; + $args->email_host = "ar.ro"; + $args->user_name = "trident"; + $args->nick_name = "aloha"; + $args->homepage = "http://jkgjfk./ww"; + $args->allow_mailing = "Y"; + $args->allow_message = "Y"; + $args->denied = "N"; + $args->limit_date = ""; + $args->regdate = "20110607121952"; + $args->change_password_date = "20110607121952"; + $args->last_login = "20110607121952"; + $args->is_admin = "N"; + $args->extra_vars = "O:8:\"stdClass\":2:{s:4:\"body\";s:0:\"\";s:7:\"_filter\";s:6:\"insert\";}"; + $args->list_order = -203; + '; + $expected = 'INSERT INTO "xe_member" + ("member_srl", "user_id", "email_address", "password", "email_id", "email_host", "user_name", "nick_name", + "homepage", "allow_mailing", "allow_message", "denied", "limit_date", "regdate", "change_password_date", + "last_login", "is_admin", "extra_vars", "list_order") + VALUES (203, \'cacao\', \'teta@ar.ro\', \'23e5484cb88f3c07bcce2920a5e6a2a7\', \'teta\', \'ar.ro\', \'trident\', + \'aloha\', \'http://jkgjfk./ww\', \'Y\', \'Y\', \'N\', \'\', \'20110607121952\', \'20110607121952\', + \'20110607121952\', \'N\', \'O:8:"stdClass":2:{s:4:"body";s:0:"";s:7:"_filter";s:6:"insert";}\', -203)'; + $this->_test($xml_file, $argsString, $expected); + } + + function test_module_insertModuleExtraVars(){ + $xml_file = _XE_PATH_ . "modules/module/queries/insertModuleExtraVars.xml"; + $argsString = ' $args->module_srl = 202; + $args->name = "_filter"; + $args->value = "insert_page"; + '; + $expected = 'INSERT INTO "xe_module_extra_vars" + ("module_srl", "name", "value") + VALUES (202, \'_filter\', \'insert_page\') + '; + $this->_test($xml_file, $argsString, $expected); + } // $queryTester->test_admin_deleteActionForward(); // $queryTester->test_module_insertModule(); - - + } \ No newline at end of file diff --git a/test-phpUnit/SelectXmlTest_Cubrid.php b/test-phpUnit/SelectXmlTest_Cubrid.php index 424d086d6..2fffbe3f7 100644 --- a/test-phpUnit/SelectXmlTest_Cubrid.php +++ b/test-phpUnit/SelectXmlTest_Cubrid.php @@ -5,14 +5,16 @@ function _test($xml_file, $argsString, $expected){ $tester = new QueryTester(); - $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString); + $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid'); + //echo $outputString; $output = eval($outputString); if(!is_a($output, 'Query')){ if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; }else { - $db = new DBCubrid(); + //$db = new DBCubrid(); + $db = &DB::getInstance('cubrid'); $querySql = $db->getSelectSql($output); // Remove whitespaces, tabs and all diff --git a/test-phpUnit/UpdateXmlTest_Cubrid.php b/test-phpUnit/UpdateXmlTest_Cubrid.php index dbb15edb9..f6cc7707a 100644 --- a/test-phpUnit/UpdateXmlTest_Cubrid.php +++ b/test-phpUnit/UpdateXmlTest_Cubrid.php @@ -5,12 +5,13 @@ function _test($xml_file, $argsString, $expected){ $tester = new QueryTester(); - $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString); + $outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid'); $output = eval($outputString); if(!is_a($output, 'Query')){ if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat."; }else { - $db = new DBCubrid(); + //$db = new DBCubrid(); + $db = &DB::getInstance('cubrid'); $querySql = $db->getUpdateSql($output); // Remove whitespaces, tabs and all @@ -47,6 +48,39 @@ AND "module_srl" = 47374'; $this->_test($xml_file, $argsString, $expected); } + function test_module_updateMember(){ + $xml_file = _XE_PATH_ . "modules/member/queries/updateLastLogin.xml"; + $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); + } + + function test_module_updatePoint(){ + $xml_file = _XE_PATH_ . "modules/point/queries/updatePoint.xml"; + $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); + } + + 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); + } + + 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); + } // $queryTester->test_admin_deleteActionForward(); // $queryTester->test_module_insertModule();