mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
Update test folder structure.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8540 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0a53ac3e9d
commit
c3fdbbf399
10 changed files with 63 additions and 45 deletions
|
|
@ -16,8 +16,7 @@
|
||||||
$newXmlQueryParser = new XmlQueryParser($db_type);
|
$newXmlQueryParser = new XmlQueryParser($db_type);
|
||||||
$xml_obj = $newXmlQueryParser->getXmlFileContent($xml_file);
|
$xml_obj = $newXmlQueryParser->getXmlFileContent($xml_file);
|
||||||
|
|
||||||
$dbParser = $newXmlQueryParser->getDBParser();
|
$parser = new QueryParser($xml_obj->query);
|
||||||
$parser = new QueryParser($xml_obj->query, $dbParser);
|
|
||||||
return $parser->toString();
|
return $parser->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
|
||||||
class ExpressionParserTest extends PHPUnit_Framework_TestCase {
|
class ExpressionParserTest extends PHPUnit_Framework_TestCase {
|
||||||
/* Escape char for:
|
/* Escape char for:
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php');
|
||||||
|
|
||||||
class DeleteXmlTest_Cubrid extends PHPUnit_Framework_TestCase {
|
class CubridDeleteTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected){
|
function _test($xml_file, $argsString, $expected){
|
||||||
$tester = new QueryTester();
|
$tester = new QueryTester();
|
||||||
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid');
|
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString);
|
||||||
$output = eval($outputString);
|
$output = eval($outputString);
|
||||||
|
|
||||||
if(!is_a($output, 'Query')){
|
if(!is_a($output, 'Query')){
|
||||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||||
}else {
|
}else {
|
||||||
//$db = new DBCubrid();
|
$db = &DB::getInstance();
|
||||||
$db = &DB::getInstance('cubrid');
|
var_dump($db);
|
||||||
$querySql = $db->getDeleteSql($output);
|
$querySql = $db->getDeleteSql($output);
|
||||||
|
|
||||||
// Remove whitespaces, tabs and all
|
// Remove whitespaces, tabs and all
|
||||||
|
|
@ -29,15 +30,10 @@
|
||||||
$argsString = '$args->module = "page";
|
$argsString = '$args->module = "page";
|
||||||
$args->type = "page";
|
$args->type = "page";
|
||||||
$args->act = "tata";';
|
$args->act = "tata";';
|
||||||
$expected = 'delete from "xe_action_forward" as "action_forward"
|
$expected = 'delete "action_forward" from "xe_action_forward" as "action_forward"
|
||||||
where "module" = \'page\'
|
where "module" = \'page\'
|
||||||
and "type" = \'page\'
|
and "type" = \'page\'
|
||||||
and "act" = \'tata\'';
|
and "act" = \'tata\'';
|
||||||
$this->_test($xml_file, $argsString, $expected);
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $queryTester->test_admin_deleteActionForward();
|
|
||||||
// $queryTester->test_module_insertModule();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php');
|
||||||
|
|
||||||
class InsertXmlTest_Cubrid extends PHPUnit_Framework_TestCase {
|
class CubridInsertTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected){
|
function _test($xml_file, $argsString, $expected){
|
||||||
$tester = new QueryTester();
|
$tester = new QueryTester();
|
||||||
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid');
|
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString);
|
||||||
$output = eval($outputString);
|
$output = eval($outputString);
|
||||||
|
|
||||||
if(!is_a($output, 'Query')){
|
if(!is_a($output, 'Query')){
|
||||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||||
}else {
|
}else {
|
||||||
//$db = new DBCubrid();
|
$db = &DB::getInstance();
|
||||||
$db = &DB::getInstance('cubrid');
|
|
||||||
$querySql = $db->getInsertSql($output);
|
$querySql = $db->getInsertSql($output);
|
||||||
|
|
||||||
// Remove whitespaces, tabs and all
|
// Remove whitespaces, tabs and all
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
$this->assertEquals($expected, $querySql);
|
$this->assertEquals($expected, $querySql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: this test can fail when comaparing regdate from the $args with
|
||||||
|
* regdate from the expected string - a few seconds difference
|
||||||
|
*/
|
||||||
function test_module_insertModule(){
|
function test_module_insertModule(){
|
||||||
$xml_file = _XE_PATH_ . "modules/module/queries/insertModule.xml";
|
$xml_file = _XE_PATH_ . "modules/module/queries/insertModule.xml";
|
||||||
$argsString = ' $args->module_category_srl = 0;
|
$argsString = ' $args->module_category_srl = 0;
|
||||||
|
|
@ -136,7 +140,5 @@
|
||||||
';
|
';
|
||||||
$this->_test($xml_file, $argsString, $expected);
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
}
|
}
|
||||||
// $queryTester->test_admin_deleteActionForward();
|
|
||||||
// $queryTester->test_module_insertModule();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php');
|
||||||
|
|
||||||
class SelectXmlTest_Cubrid extends PHPUnit_Framework_TestCase {
|
class CubridSelectTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected){
|
function _test($xml_file, $argsString, $expected){
|
||||||
$tester = new QueryTester();
|
$tester = new QueryTester();
|
||||||
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid');
|
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString);
|
||||||
|
|
||||||
//echo $outputString;
|
//echo $outputString;
|
||||||
$output = eval($outputString);
|
$output = eval($outputString);
|
||||||
|
|
@ -14,7 +15,7 @@
|
||||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||||
}else {
|
}else {
|
||||||
//$db = new DBCubrid();
|
//$db = new DBCubrid();
|
||||||
$db = &DB::getInstance('cubrid');
|
$db = &DB::getInstance();
|
||||||
$querySql = $db->getSelectSql($output);
|
$querySql = $db->getSelectSql($output);
|
||||||
|
|
||||||
// Remove whitespaces, tabs and all
|
// Remove whitespaces, tabs and all
|
||||||
|
|
@ -194,14 +195,6 @@
|
||||||
|
|
||||||
$this->assertTrue(is_int($output->page));
|
$this->assertTrue(is_int($output->page));
|
||||||
// $this->assertTrue($output->page == 5);
|
// $this->assertTrue($output->page == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $queryTester->test_admin_deleteActionForward();
|
|
||||||
// $queryTester->test_module_insertModule();
|
|
||||||
// $queryTester->test_module_updateModule();
|
|
||||||
|
|
||||||
|
|
||||||
// $queryTester->test_opage_getOpageList();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php');
|
||||||
|
|
||||||
class UpdateXmlTest_Cubrid extends PHPUnit_Framework_TestCase {
|
class CubridUpdateTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected){
|
function _test($xml_file, $argsString, $expected){
|
||||||
$tester = new QueryTester();
|
$tester = new QueryTester();
|
||||||
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString, 'cubrid');
|
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString);
|
||||||
$output = eval($outputString);
|
$output = eval($outputString);
|
||||||
if(!is_a($output, 'Query')){
|
if(!is_a($output, 'Query')){
|
||||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||||
}else {
|
}else {
|
||||||
//$db = new DBCubrid();
|
$db = &DB::getInstance();
|
||||||
$db = &DB::getInstance('cubrid');
|
|
||||||
$querySql = $db->getUpdateSql($output);
|
$querySql = $db->getUpdateSql($output);
|
||||||
|
|
||||||
// Remove whitespaces, tabs and all
|
// Remove whitespaces, tabs and all
|
||||||
8
test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php
Normal file
8
test-phpUnit/db/xml_query/cubrid/config.cubrid.inc.php
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
$oContext = &Context::getInstance();
|
||||||
|
|
||||||
|
$db_info->db_type = 'cubrid';
|
||||||
|
$db_info->db_table_prefix = 'xe';
|
||||||
|
|
||||||
|
$oContext->setDbInfo($db_info);
|
||||||
|
?>
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
require('config.inc.php');
|
require(_XE_PATH_ . 'test-phpUnit/config.inc.php');
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/db/xml_query/mssql/config.mssql.inc.php');
|
||||||
|
|
||||||
class SelectXmlTest_Mssql extends PHPUnit_Framework_TestCase {
|
class MssqlSelectTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
||||||
$tester = new QueryTester();
|
$tester = new QueryTester();
|
||||||
$outputString = $tester->getNewParserOutputString($xml_file, '[', $argsString, 'mssql');
|
$outputString = $tester->getNewParserOutputString($xml_file, '[', $argsString);
|
||||||
//echo $outputString;
|
//echo $outputString;
|
||||||
$output = eval($outputString);
|
$output = eval($outputString);
|
||||||
|
|
||||||
if(!is_a($output, 'Query')){
|
if(!is_a($output, 'Query')){
|
||||||
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
if(!$output->toBool()) $querySql = "Date incorecte! Query-ul nu a putut fi executat.";
|
||||||
}else {
|
}else {
|
||||||
$db = &DB::getInstance('mssql');
|
$db = &DB::getInstance();
|
||||||
$querySql = $db->getSelectSql($output);
|
$querySql = $db->getSelectSql($output);
|
||||||
$queryArguments = $output->getArguments();
|
$queryArguments = $output->getArguments();
|
||||||
|
|
||||||
8
test-phpUnit/db/xml_query/mssql/config.mssql.inc.php
Normal file
8
test-phpUnit/db/xml_query/mssql/config.mssql.inc.php
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
$oContext = &Context::getInstance();
|
||||||
|
|
||||||
|
$db_info->db_type = 'mssql';
|
||||||
|
$db_info->db_table_prefix = 'xe';
|
||||||
|
|
||||||
|
$oContext->setDbInfo($db_info);
|
||||||
|
?>
|
||||||
11
test-phpUnit/debug.php
Normal file
11
test-phpUnit/debug.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
require('config.inc.php');
|
||||||
|
$oDB = &DB::getInstance('mssql');
|
||||||
|
//$oDB = &DB::getInstance();
|
||||||
|
$dbParser = $oDB->getParser();
|
||||||
|
$dbParser = new DBParser('[', ']');
|
||||||
|
$parser = new QueryParser($xml_obj->query, $dbParser);
|
||||||
|
$query_file = $parser->toString();
|
||||||
|
var_dump($parser->toString());
|
||||||
|
|
||||||
|
?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue