From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- tests/simple_unit/SqlMap/common.php | 308 ++++++++++++++++++------------------ 1 file changed, 154 insertions(+), 154 deletions(-) (limited to 'tests/simple_unit/SqlMap/common.php') diff --git a/tests/simple_unit/SqlMap/common.php b/tests/simple_unit/SqlMap/common.php index aaba8c80..5146d123 100644 --- a/tests/simple_unit/SqlMap/common.php +++ b/tests/simple_unit/SqlMap/common.php @@ -1,155 +1,155 @@ - 0) - $connection->createCommand($line)->execute(); - } - } -} - -class CopyFileScriptRunner -{ - protected $baseFile; - protected $targetFile; - - public function __construct($base, $target) - { - $this->baseFile = $base; - $this->targetFile = $target; - } - - function runScript($connection, $script) - { - copy($this->baseFile, $this->targetFile); - } -} - -class SQLiteBaseTestConfig extends BaseTestConfig -{ - protected $baseFile; - protected $targetFile; - - public function __construct() - { - $this->_sqlmapConfigFile = SQLMAP_TESTS.'/sqlite.xml'; - $this->_scriptDir = SQLMAP_TESTS.'/scripts/sqlite/'; - - $this->targetFile = realpath(SQLMAP_TESTS.'/sqlite/tests.db'); - $this->baseFile = realpath(SQLMAP_TESTS.'/sqlite/backup.db'); - $file = realpath($this->targetFile); - $this->_connection = new TDbConnection("sqlite:{$file}"); - } - - public function getScriptRunner() - { - return new CopyFileScriptRunner($this->baseFile, $this->targetFile); - } -} - -class MySQLBaseTestConfig extends BaseTestConfig -{ - public function __construct() - { - $this->_sqlmapConfigFile = SQLMAP_TESTS.'/mysql.xml'; - $this->_scriptDir = SQLMAP_TESTS.'/scripts/mysql/'; - $this->_features = array('insert_id'); - $dsn = 'mysql:host=localhost;dbname=sqlmap_test;port=3307'; - $this->_connection = new TDbConnection($dsn, 'test5', 'test5'); - } -} - -class MSSQLBaseTestConfig extends BaseTestConfig -{ - public function __construct() - { - $this->_sqlmap = SQLMAP_TESTS.'/mssql.xml'; - $this->_connectionString = 'odbc_mssql://sqlmap_tests'; - $this->_scriptDir = SQLMAP_TESTS.'/scripts/mssql/'; - $this->_features = array('insert_id'); - } -} - -class BaseTestConfig -{ - protected $_scriptDir; - protected $_connection; - protected $_sqlmapConfigFile; - - public function hasFeature($type) - { - return false; - } - - public function getScriptDir() - { - return $this->_scriptDir; - } - - public function getConnection() - { - return $this->_connection; - } - - public function getSqlMapConfigFile() - { - return $this->_sqlmapConfigFile; - } - - public function getScriptRunner() - { - return new DefaultScriptRunner(); - } - - public static function createConfigInstance() - { - //change this to connection to a different database - - //return new MySQLBaseTestConfig(); - - return new SQLiteBaseTestConfig(); - - //return new MSSQLBaseTestConfig(); - } -} - - + 0) + $connection->createCommand($line)->execute(); + } + } +} + +class CopyFileScriptRunner +{ + protected $baseFile; + protected $targetFile; + + public function __construct($base, $target) + { + $this->baseFile = $base; + $this->targetFile = $target; + } + + function runScript($connection, $script) + { + copy($this->baseFile, $this->targetFile); + } +} + +class SQLiteBaseTestConfig extends BaseTestConfig +{ + protected $baseFile; + protected $targetFile; + + public function __construct() + { + $this->_sqlmapConfigFile = SQLMAP_TESTS.'/sqlite.xml'; + $this->_scriptDir = SQLMAP_TESTS.'/scripts/sqlite/'; + + $this->targetFile = realpath(SQLMAP_TESTS.'/sqlite/tests.db'); + $this->baseFile = realpath(SQLMAP_TESTS.'/sqlite/backup.db'); + $file = realpath($this->targetFile); + $this->_connection = new TDbConnection("sqlite:{$file}"); + } + + public function getScriptRunner() + { + return new CopyFileScriptRunner($this->baseFile, $this->targetFile); + } +} + +class MySQLBaseTestConfig extends BaseTestConfig +{ + public function __construct() + { + $this->_sqlmapConfigFile = SQLMAP_TESTS.'/mysql.xml'; + $this->_scriptDir = SQLMAP_TESTS.'/scripts/mysql/'; + $this->_features = array('insert_id'); + $dsn = 'mysql:host=localhost;dbname=sqlmap_test;port=3307'; + $this->_connection = new TDbConnection($dsn, 'test5', 'test5'); + } +} + +class MSSQLBaseTestConfig extends BaseTestConfig +{ + public function __construct() + { + $this->_sqlmap = SQLMAP_TESTS.'/mssql.xml'; + $this->_connectionString = 'odbc_mssql://sqlmap_tests'; + $this->_scriptDir = SQLMAP_TESTS.'/scripts/mssql/'; + $this->_features = array('insert_id'); + } +} + +class BaseTestConfig +{ + protected $_scriptDir; + protected $_connection; + protected $_sqlmapConfigFile; + + public function hasFeature($type) + { + return false; + } + + public function getScriptDir() + { + return $this->_scriptDir; + } + + public function getConnection() + { + return $this->_connection; + } + + public function getSqlMapConfigFile() + { + return $this->_sqlmapConfigFile; + } + + public function getScriptRunner() + { + return new DefaultScriptRunner(); + } + + public static function createConfigInstance() + { + //change this to connection to a different database + + //return new MySQLBaseTestConfig(); + + return new SQLiteBaseTestConfig(); + + //return new MSSQLBaseTestConfig(); + } +} + + ?> \ No newline at end of file -- cgit v1.2.3