diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..29e35256 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ + +*.xml +*.lock +vendor +.phpunit.result.cache +build +tests/sqlite/ez_test.sqlite3 +tmp +composer.lock diff --git a/composer.json b/composer.json index c5d87a23..ed3edacf 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "jv2222/ezsql", "description": "PHP class to make interacting with a database ridiculusly easy.", - "license": "LGPL", + "license": "LGPL-3.0-or-later", "authors": [ { "name": "Justin Vincent", diff --git a/tests/mssql/ezSQL_mssqlTest.php b/tests/mssql/ezSQL_mssqlTest.php deleted file mode 100644 index 8c6a9111..00000000 --- a/tests/mssql/ezSQL_mssqlTest.php +++ /dev/null @@ -1,145 +0,0 @@ - - * @link http://twitter.com/justinvincent - * @name ezSQL_mssqlTest - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - * @todo The connection to MS SQL Server is not tested by now. There might also - * be tests done for different versions of SQL Server - * - */ -class ezSQL_mssqlTest extends TestCase { - - /** - * @var ezSQL_mssql - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('ntwdblib')) { - $this->markTestSkipped( - 'The MS-SQL extenstion is not available.' - ); - } - require_once 'mssql/ez_sql_mssql.php'; - $this->object = new ezSQL_mssql; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_mssql::quick_connect - * @todo Implement testQuick_connect(). - */ - public function testQuick_connect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuick_connect - - /** - * @covers ezSQL_mssql::connect - * @todo Implement testConnect(). - */ - public function testConnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testConnect - - /** - * @covers ezSQL_mssql::select - * @todo Implement testSelect(). - */ - public function testSelect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testSelect - - /** - * @covers ezSQL_mssql::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_mssql::sysdate - */ - public function testSysdate() { - $this->assertEquals('getDate()', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_mssql::query - * @todo Implement testQuery(). - */ - public function testQuery() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuery - - /** - * @covers ezSQL_mssql::ConvertMySqlToMSSql - * @todo Implement testConvertMySqlToMSSql(). - */ - public function testConvertMySqlToMSSql() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testConvert - - /** - * @covers ezSQL_mssql::disconnect - * @todo Implement testDisconnect(). - */ - public function testDisconnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testDisconnect - - /** - * @covers ezSQL_mssql::getDBHost - * @todo Implement testGetDBHost(). - */ - public function testGetDBHost() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testGetDBHost - -} // ezSQL_mssqlTest diff --git a/tests/mysql/ezSQL_mysqlTest.php b/tests/mysql/ezSQL_mysqlTest.php deleted file mode 100644 index aaed89df..00000000 --- a/tests/mysql/ezSQL_mysqlTest.php +++ /dev/null @@ -1,209 +0,0 @@ - - * @name ezSQL_mysqlTest - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - */ -class ezSQL_mysqlTest extends TestCase { - - /** - * constant string user name - */ - const TEST_DB_USER = 'ez_test'; - - /** - * constant string password - */ - const TEST_DB_PASSWORD = 'ezTest'; - - /** - * constant database name - */ - const TEST_DB_NAME = 'ez_test'; - - /** - * constant database host - */ - const TEST_DB_HOST = 'localhost'; - - /** - * constant database connection charset - */ - const TEST_DB_CHARSET = 'utf8'; - - /** - * @var ezSQL_mysql - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('mysql')) { - $this->markTestSkipped( - 'The MySQL Lib is not available.' - ); - } - require_once 'mysql/ez_sql_mysql.php'; - $this->object = new ezSQL_mysql; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } - - /** - * @covers ezSQL_mysql::quick_connect - */ - public function testQuick_connect() { - $result = $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME); - - $this->assertTrue($result); - } - - /** - * @covers ezSQL_mysql::quick_connect - */ - public function testQuick_connect2() { - $result = $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_CHARSET); - - $this->assertTrue($result); - } - - /** - * @covers ezSQL_mysql::connect - */ - public function testConnect() { - $result = $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->assertTrue($result); - } // testConnect - - /** - * @covers ezSQL_mysql::select - */ - public function testSelect() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - $this->assertTrue($this->object->isConnected()); - - $result = $this->object->select(self::TEST_DB_NAME); - - $this->assertTrue($result); - } // testSelect - - /** - * @covers ezSQL_mysql::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is\\'nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_mysql::sysdate - */ - public function testSysdate() { - $this->assertEquals('NOW()', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_mysql::query - */ - public function testQueryInsert() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))'), 0); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - $this->assertEquals($this->object->query('DROP TABLE unit_test'), 0); - } // testQueryInsert - - /** - * @covers ezSQL_mysql::query - */ - public function testQuerySelect() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))'), 0); - - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(2, \'test 2\')'), 1); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(3, \'test 3\')'), 1); - - $result = $this->object->query('SELECT * FROM unit_test'); - - $i = 1; - foreach ($this->object->get_results() as $row) { - $this->assertEquals($i, $row->id); - $this->assertEquals('test ' . $i, $row->test_key); - ++$i; - } - - $this->assertEquals($this->object->query('DROP TABLE unit_test'), 0); - } // testQuerySelect - - /** - * @covers ezSQL_mysql::getDBHost - */ - public function testGetDBHost() { - $this->assertEquals(self::TEST_DB_HOST, $this->object->getDBHost()); - } // testGetDBHost - - /** - * @covers ezSQL_mysql::getCharset - */ - public function testGetCharset() { - $this->assertEquals(self::TEST_DB_CHARSET, $this->object->getCharset()); - } // testGetCharset - - /** - * @covers ezSQL_mysql::disconnect - */ - public function testDisconnect() { - $this->object->disconnect(); - - $this->assertTrue(true); - } // testDisconnect - - /** - * @covers ezSQL_mysql::getInsertId - */ - public function testGetInsertId() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id int(11) NOT NULL AUTO_INCREMENT, test_key varchar(50), PRIMARY KEY (ID))ENGINE=MyISAM DEFAULT CHARSET=utf8'), 0); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - - $this->assertEquals(1, $this->object->getInsertId($this->object->dbh)); - - $this->assertEquals($this->object->query('DROP TABLE unit_test'), 0); - } // testInsertId - -} // ezSQL_mysqlTest diff --git a/tests/mysql/ezSQL_mysqliTest.php b/tests/mysql/ezSQL_mysqliTest.php deleted file mode 100644 index da32a5ad..00000000 --- a/tests/mysql/ezSQL_mysqliTest.php +++ /dev/null @@ -1,227 +0,0 @@ - - * @name ezSQL_mysqliTest - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - */ -class ezSQL_mysqliTest extends TestCase { - - /** - * constant string user name - */ - const TEST_DB_USER = 'ez_test'; - - /** - * constant string password - */ - const TEST_DB_PASSWORD = 'ezTest'; - - /** - * constant database name - */ - const TEST_DB_NAME = 'ez_test'; - - /** - * constant database host - */ - const TEST_DB_HOST = 'localhost'; - - /** - * constant database connection charset - */ - const TEST_DB_CHARSET = 'utf8'; - - /** - * @var ezSQL_mysqli - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('mysqli')) { - $this->markTestSkipped( - 'The MySQLi extension is not available.' - ); - } - require_once 'mysqli/ez_sql_mysqli.php'; - $this->object = new ezSQL_mysqli(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - if ($this->object->isConnected()) { - $this->object->select(self::TEST_DB_NAME); - $this->assertEquals($this->object->query('DROP TABLE IF EXISTS unit_test'), 0); - } - $this->object = null; - } - - /** - * @covers ezSQL_mysqli::quick_connect - */ - public function testQuick_connect() { - $result = $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME); - - $this->assertTrue($result); - } - - /** - * @covers ezSQL_mysqli::quick_connect - */ - public function testQuick_connect2() { - $result = $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_CHARSET); - - $this->assertTrue($result); - } - - /** - * @covers ezSQL_mysqli::connect - */ - public function testConnect() { - $result = $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->assertTrue($result); - } // testConnect - - /** - * @covers ezSQL_mysqli::select - */ - public function testSelect() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - $this->assertTrue($this->object->isConnected()); - - $result = $this->object->select(self::TEST_DB_NAME); - - $this->assertTrue($result); - } // testSelect - - /** - * @covers ezSQL_mysqli::escape - */ - public function testEscape() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is\\'nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_mysqli::sysdate - */ - public function testSysdate() { - $this->assertEquals('NOW()', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_mysqli::query - */ - public function testQueryInsert() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))'), 0); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - } // testQueryInsert - - /** - * @covers ezSQL_mysqli::query - */ - public function testQuerySelect() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))'), 0); - - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(2, \'test 2\')'), 1); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(3, \'test 3\')'), 1); - - $result = $this->object->query('SELECT * FROM unit_test'); - - $i = 1; - foreach ($this->object->get_results() as $row) { - $this->assertEquals($i, $row->id); - $this->assertEquals('test ' . $i, $row->test_key); - ++$i; - } - } // testQuerySelect - - /** - * @covers ezSQL_mysqli::getDBHost - */ - public function testGetDBHost() { - $this->assertEquals(self::TEST_DB_HOST, $this->object->getDBHost()); - } // testGetDBHost - - /** - * @covers ezSQL_mysqli::getCharset - */ - public function testGetCharset() { - $this->assertEquals(self::TEST_DB_CHARSET, $this->object->getCharset()); - } // testGetCharset - - /** - * @covers ezSQL_mysqli::disconnect - */ - public function testDisconnect() { - $this->object->disconnect(); - - $this->assertTrue(true); - } // testDisconnect - - /** - * @covers ezSQL_mysqli::getInsertId - */ - public function testGetInsertId() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id int(11) NOT NULL AUTO_INCREMENT, test_key varchar(50), PRIMARY KEY (ID))ENGINE=MyISAM DEFAULT CHARSET=utf8'), 0); - $this->assertEquals($this->object->query('INSERT INTO unit_test(id, test_key) VALUES(1, \'test 1\')'), 1); - - $this->assertEquals(1, $this->object->getInsertId($this->object->dbh)); - } // testInsertId - - /** - * @covers ezSQL_mysqli::prepare - */ - public function testPrepare() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); - - $this->object->select(self::TEST_DB_NAME); - - $parameter = '\'test 1\''; - - $this->assertEquals($this->object->query('CREATE TABLE unit_test(id int(11) NOT NULL AUTO_INCREMENT, test_key varchar(50), PRIMARY KEY (ID))ENGINE=MyISAM DEFAULT CHARSET=utf8'), 0); - $result = $this->object->prepare('INSERT INTO unit_test(id, test_key) VALUES(1, ?)'); - $this->assertInstanceOf('mysqli_stmt', $result); - $result->bind_param('s', $parameter); - - $this->assertTrue($result->execute()); - } // testPrepare - -} // ezSQL_mysqliTest diff --git a/tests/oracle8_9/ezSQL_oracle8_9Test.php b/tests/oracle8_9/ezSQL_oracle8_9Test.php deleted file mode 100644 index 339bcb26..00000000 --- a/tests/oracle8_9/ezSQL_oracle8_9Test.php +++ /dev/null @@ -1,174 +0,0 @@ - - * @link http://twitter.com/justinvincent - * @name ezSQL_oracle8_9Test - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - * @todo The connection to Oracle is not tested by now. There might also be - * tests done for different versions of Oracle - * - */ -class ezSQL_oracle8_9Test extends TestCase { - - /** - * @var ezSQL_oracle8_9 - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('oci8_12c')) { - $this->markTestSkipped( - 'The Oracle OCI Lib is not available.' - ); - } - require_once 'oracle8_9/ez_sql_oracle8_9.php'; - $this->object = new ezSQL_oracle8_9; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_oracle8_9::connect - * @todo Implement testConnect(). - */ - public function testConnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testConnect - - /** - * @covers ezSQL_oracle8_9::quick_connect - * @todo Implement testQuick_connect(). - */ - public function testQuick_connect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuick_connect - - /** - * @covers ezSQL_oracle8_9::select - * @todo Implement testSelect(). - */ - public function testSelect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testSelect - - /** - * @covers ezSQL_oracle8_9::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_oracle8_9::sysdate - */ - public function testSysdate() { - $this->assertEquals('SYSDATE', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_oracle8_9::is_equal_str - */ - public function testIs_equal_str() { - $expected = '= \'ezTest string\''; - - $this->assertEquals($expected, $this->object->is_equal_str('ezTest string')); - } // testIs_equal_str - - /** - * @covers ezSQL_oracle8_9::is_equal_int - */ - public function testIs_equal_int() { - $expected = '= 123'; - - $this->assertEquals($expected, $this->object->is_equal_int(123)); - } // testIs_equal_int - - /** - * @covers ezSQL_oracle8_9::insert_id - * @todo Implement testInsert_id(). - */ - public function testInsert_id() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testInsert_id - - /** - * @covers ezSQL_oracle8_9::nextVal - * @todo Implement testNextVal(). - */ - public function testNextVal() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testNextVal - - /** - * @covers ezSQL_oracle8_9::query - * @todo Implement testQuery(). - */ - public function testQuery() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuery - - /** - * @covers ezSQL_oracle8_9::disconnect - * @todo Implement testDisconnect(). - */ - public function testDisconnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testDisconnect - - /** - * @covers ezSQL_oracle8_9::getDBName - * @todo Implement testGetDBName(). - */ - public function testGetDBName() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testGetDBName - -} // ezSQL_oracle8_9Test \ No newline at end of file diff --git a/tests/oracle8_9/ezSQL_oracleTNSTest_.php b/tests/oracle8_9/ezSQL_oracleTNSTest_.php deleted file mode 100644 index 64b75d3e..00000000 --- a/tests/oracle8_9/ezSQL_oracleTNSTest_.php +++ /dev/null @@ -1,235 +0,0 @@ - 'CMP', - 'Password' => 'cmp', - 'Host' => 'en-yoda-1', - 'Port' => '1521', - 'SessionName' => 'ppisa.febi.bilstein.local', - 'TNS' => 'AL32UTF8' - ); - - private $sequenceName = 'UNITTEST_ORATNS'; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('oci8_12c')) { - $this->markTestSkipped( - 'The Oracle OCI Lib is not available.' - ); - } - require_once 'oracle8_9/ez_sql_oracleTNS.php'; - $this->object = new ezSQL_oracleTNS( - $this->oraConnectionParamsTestConnection['Host'], - $this->oraConnectionParamsTestConnection['Port'], - $this->oraConnectionParamsTestConnection['SessionName'], - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'], - $this->oraConnectionParamsTestConnection['TNS'] - ); - - // Create the sequence - $sql = 'CREATE SEQUENCE ' . $this->sequenceName; - $this->object->query($sql); - - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - // Drop the sequence - $sql = 'DROP SEQUENCE ' . $this->sequenceName; - $this->object->query($sql); - - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_oracleTNS::connect - */ - public function testConnect() { - $this->object->connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - $this->assertTrue($this->object->isConnected()); - } // testConnect - - /** - * To test connection pooling with oci_pconnect instead of oci_connect - * @covers ezSQL_oracleTNS::connect - */ - public function testPConnect() { - $this->object = null; - - $this->object = new ezSQL_oracleTNS( - $this->oraConnectionParamsTestConnection['Host'], - $this->oraConnectionParamsTestConnection['Port'], - $this->oraConnectionParamsTestConnection['SessionName'], - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'], - $this->oraConnectionParamsTestConnection['TNS'], - true - ); - - $this->object->connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - $this->assertTrue($this->object->isConnected()); - - $sql = 'SELECT 5*5 AS TEST_RESULT FROM DUAL'; - - $recordset = $this->object->query($sql); - $this->assertEquals(1, $recordset); - } // testPConnect - - /** - * @covers ezSQL_oracleTNS::quick_connect - */ - public function testQuick_connect() { - $this->object->quick_connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - $this->assertTrue(true); - } // testQuick_connect - - /** - * @covers ezSQL_oracleTNS::select - */ - public function testSelect() { - $this->object->select( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - $this->assertTrue(true); - } // testSelect - - /** - * @covers ezSQL_oracleTNS::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_oracleTNS::sysdate - */ - public function testSysdate() { - $this->assertEquals('SYSDATE', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_oracleTNS::is_equal_str - */ - public function testIs_equal_str() { - $expected = '= \'ezTest string\''; - - $this->assertEquals($expected, $this->object->is_equal_str('ezTest string')); - } // testIs_equal_str - - /** - * @covers ezSQL_oracleTNS::is_equal_int - */ - public function testIs_equal_int() { - $expected = '= 123'; - - $this->assertEquals($expected, $this->object->is_equal_int(123)); - } // testIs_equal_int - - /** - * @covers ezSQL_oracleTNS::insert_id - */ - public function testInsert_id() { - $this->object->connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - - $result = $this->object->insert_id($this->sequenceName); - - $this->assertEquals(1, $result); - - $result = $this->object->insert_id($this->sequenceName); - - $this->assertEquals(2, $result); - } // testInsert_id - - /** - * @covers ezSQL_oracleTNS::nextVal - */ - public function testNextVal() { - $this->object->connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - $result = $this->object->nextVal($this->sequenceName); - - $this->assertEquals(1, $result); - - $result = $this->object->nextVal($this->sequenceName); - - $this->assertEquals(2, $result); - } // testNextVal - - /** - * @covers ezSQL_oracleTNS::query - */ - public function testQuery() { - $this->object->connect( - $this->oraConnectionParamsTestConnection['User'], - $this->oraConnectionParamsTestConnection['Password'] - ); - - $sql = 'SELECT 5*5 AS TEST_RESULT FROM DUAL'; - - $recordset = $this->object->query($sql); - $this->assertEquals(1, $recordset); - } // testQuery - - /** - * @covers ezSQL_oracleTNS::disconnect - */ - public function testDisconnect() { - $this->object->disconnect(); - - $this->assertFalse($this->object->isConnected()); - } // testDisconnect - -} // ezSQL_oracleTNSTest \ No newline at end of file diff --git a/tests/pdo/ezSQL_pdoTest.php b/tests/pdo/ezSQL_pdoTest.php deleted file mode 100644 index cac2239b..00000000 --- a/tests/pdo/ezSQL_pdoTest.php +++ /dev/null @@ -1,384 +0,0 @@ - - * @name ezSQL_pdoTest - * @uses ez_test.sqlite - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - */ -class ezSQL_pdoTest extends TestCase { - - /** - * constant string user name - */ - const TEST_DB_USER = 'ez_test'; - - /** - * constant string password - */ - const TEST_DB_PASSWORD = 'ezTest'; - - /** - * constant string database name - */ - const TEST_DB_NAME = 'ez_test'; - - /** - * constant string database host - */ - const TEST_DB_HOST = 'localhost'; - - /** - * constant string database connection charset - */ - const TEST_DB_CHARSET = 'utf8'; - - /** - * constant string database port - */ - const TEST_DB_PORT = '5432'; - - /** - * constant string path and file name of the SQLite test database - */ - const TEST_SQLITE_DB = 'tests/pdo/ez_test.sqlite'; - - /** - * @var ezSQL_pdo - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('pdo_mysql')) { - $this->markTestSkipped( - 'The pdo_mysql Lib is not available.' - ); - } - if (!extension_loaded('pdo_pgsql')) { - $this->markTestSkipped( - 'The pdo_pgsql Lib is not available.' - ); - } - if (!extension_loaded('pdo_sqlite')) { - $this->markTestSkipped( - 'The pdo_sqlite Lib is not available.' - ); - } - require_once 'pdo/ez_sql_pdo.php'; - $this->object = new ezSQL_pdo; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_pdo::connect - */ - public function testPosgreSQLConnect() { - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testPosgreSQLConnect - - /** - * @covers ezSQL_pdo::quick_connect - */ - public function testPosgreSQLQuick_connect() { - $this->assertTrue($this->object->quick_connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testPosgreSQLQuick_connect - - /** - * @covers ezSQL_pdo::select - */ - public function testPosgreSQLSelect() { - $this->assertTrue($this->object->select('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testPosgreSQLSelect - - /** - * @covers ezSQL_pdo::escape - */ - public function testPosgreSQLEscape() { - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testPosgreSQLEscape - - /** - * @covers ezSQL_pdo::sysdate - */ - public function testPosgreSQLSysdate() { - $this->assertEquals("datetime('now')", $this->object->sysdate()); - } // testPosgreSQLSysdate - - /** - * @covers ezSQL_pdo::catch_error - */ - public function testPosgreSQLCatch_error() { - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertNull($this->object->catch_error()); - } // testPosgreSQLCatch_error - - /** - * @covers ezSQL_pdo::query - */ - public function testPosgreSQLQuery() { - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertEquals(0, $this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))')); - - $this->assertEquals(0, $this->object->query('DROP TABLE unit_test')); - } // testPosgreSQLQuery - - /** - * @covers ezSQL_pdo::disconnect - */ - public function testPosgreSQLDisconnect() { - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->object->disconnect(); - - $this->assertTrue(true); - } // testPosgreSQLDisconnect - - /** - * @covers ezSQL_pdo::get_set - */ - public function testPostgreSQLGet_set() { - $expected = "test_var1 = '1', test_var2 = 'ezSQL test', test_var3 = 'This is''nt escaped.'"; - - $params = array( - 'test_var1' => 1, - 'test_var2' => 'ezSQL test', - 'test_var3' => "This is'nt escaped." - ); - - $this->assertTrue($this->object->connect('pgsql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertequals($expected, $this->object->get_set($params)); - } // testPostgreSQLGet_set - - /** - * Here starts the MySQL PDO unit test - */ - - /** - * @covers ezSQL_pdo::connect - */ - public function testMySQLConnect() { - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testMySQLConnect - - /** - * @covers ezSQL_pdo::quick_connect - */ - public function testMySQLQuick_connect() { - $this->assertTrue($this->object->quick_connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testMySQLQuick_connect - - /** - * @covers ezSQL_pdo::select - */ - public function testMySQLSelect() { - $this->assertTrue($this->object->select('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - } // testMySQLSelect - - /** - * @covers ezSQL_pdo::escape - */ - public function testMySQLEscape() { - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is\'nt escaped.", $result); - } // testMySQLEscape - - /** - * @covers ezSQL_pdo::sysdate - */ - public function testMySQLSysdate() { - $this->assertEquals("datetime('now')", $this->object->sysdate()); - } // testMySQLSysdate - - /** - * @covers ezSQL_pdo::catch_error - */ - public function testMySQLCatch_error() { - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertNull($this->object->catch_error()); - } // testMySQLCatch_error - - /** - * @covers ezSQL_pdo::query - */ - public function testMySQLQuery() { - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertEquals(0, $this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))')); - - $this->assertEquals(0, $this->object->query('DROP TABLE unit_test')); - } // testMySQLQuery - - /** - * @covers ezSQL_pdo::disconnect - */ - public function testMySQLDisconnect() { - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->object->disconnect(); - - $this->assertTrue(true); - } // testMySQLDisconnect - - /** - * @covers ezSQL_pdo::connect - */ - public function testMySQLConnectWithOptions() { - $options = array( - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', - ); - - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD, $options)); - } // testMySQLConnectWithOptions - - /** - * @covers ezSQL_pdo::get_set - */ - public function testMySQLGet_set() { - $expected = "test_var1 = '1', test_var2 = 'ezSQL test', test_var3 = 'This is\'nt escaped.'"; - - $params = array( - 'test_var1' => 1, - 'test_var2' => 'ezSQL test', - 'test_var3' => "This is'nt escaped." - ); - - $this->assertTrue($this->object->connect('mysql:host=' . self::TEST_DB_HOST . ';dbname=' . self::TEST_DB_NAME . ';port=' . self::TEST_DB_PORT, self::TEST_DB_USER, self::TEST_DB_PASSWORD)); - - $this->assertequals($expected, $this->object->get_set($params)); - } // testMySQLGet_set - - /** - * Here starts the SQLite PDO unit test - */ - - /** - * @covers ezSQL_pdo::connect - */ - public function testSQLiteConnect() { - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - } // testSQLiteConnect - - /** - * @covers ezSQL_pdo::quick_connect - */ - public function testSQLiteQuick_connect() { - $this->assertTrue($this->object->quick_connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - } // testSQLiteQuick_connect - - /** - * @covers ezSQL_pdo::select - */ - public function testSQLiteSelect() { - $this->assertTrue($this->object->select('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - } // testSQLiteSelect - - /** - * @covers ezSQL_pdo::escape - */ - public function testSQLiteEscape() { - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testSQLiteEscape - - /** - * @covers ezSQL_pdo::sysdate - */ - public function testSQLiteSysdate() { - $this->assertEquals("datetime('now')", $this->object->sysdate()); - } // testSQLiteSysdate - - /** - * @covers ezSQL_pdo::catch_error - */ - public function testSQLiteCatch_error() { - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - - $this->assertNull($this->object->catch_error()); - } // testSQLiteCatch_error - - /** - * @covers ezSQL_pdo::query - */ - public function testSQLiteQuery() { - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - - $this->assertEquals(0, $this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))')); - - $this->assertEquals(0, $this->object->query('DROP TABLE unit_test')); - } // testSQLiteQuery - - /** - * @covers ezSQL_pdo::disconnect - */ - public function testSQLiteDisconnect() { - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - - $this->object->disconnect(); - - $this->assertTrue(true); - } // testSQLiteDisconnect - - /** - * @covers ezSQL_pdo::get_set - */ - public function testSQLiteGet_set() { - $expected = "test_var1 = '1', test_var2 = 'ezSQL test', test_var3 = 'This is''nt escaped.'"; - - $params = array( - 'test_var1' => 1, - 'test_var2' => 'ezSQL test', - 'test_var3' => "This is'nt escaped." - ); - - $this->assertTrue($this->object->connect('sqlite:' . self::TEST_SQLITE_DB, '', '', array(), true)); - - $this->assertequals($expected, $this->object->get_set($params)); - } // testSQLiteGet_set - -} // ezSQL_pdoTest diff --git a/tests/pdo/ez_test.sqlite b/tests/pdo/ez_test.sqlite deleted file mode 100644 index 57915ff4..00000000 Binary files a/tests/pdo/ez_test.sqlite and /dev/null differ diff --git a/tests/postgresql/ezSQL_postgresqlTest.php b/tests/postgresql/ezSQL_postgresqlTest.php deleted file mode 100644 index 1e7e5434..00000000 --- a/tests/postgresql/ezSQL_postgresqlTest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @name ezSQL_postgresql_tear_up - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - */ -class ezSQL_postgresqlTest extends TestCase { - - /** - * constant string user name - */ - const TEST_DB_USER = 'ez_test'; - - /** - * constant string password - */ - const TEST_DB_PASSWORD = 'ezTest'; - - /** - * constant database name - */ - const TEST_DB_NAME = 'ez_test'; - - /** - * constant database host - */ - const TEST_DB_HOST = 'localhost'; - - /** - * constant database port - */ - const TEST_DB_PORT = '5432'; - - /** - * @var ezSQL_postgresql - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('pgsql')) { - $this->markTestSkipped( - 'The PostgreSQL Lib is not available.' - ); - } - require_once 'postgresql/ez_sql_postgresql.php'; - $this->object = new ezSQL_postgresql; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_postgresql::quick_connect - */ - public function testQuick_connect() { - $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT); - } // testQuick_connect - - /** - * @covers ezSQL_postgresql::connect - * - */ - public function testConnect() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT); - } // testConnect - - /** - * @covers ezSQL_postgresql::select - */ - public function testSelect() { - $this->object->quick_connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT); - - $this->assertTrue($this->object->select(self::TEST_DB_NAME)); - } // testSelect - - /** - * @covers ezSQL_postgresql::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_postgresql::sysdate - */ - public function testSysdate() { - $this->assertEquals('NOW()', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_postgresql::showTables - */ - public function testShowTables() { - $this->assertTrue($this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT)); - - $result = $this->object->showTables(); - - $this->assertEquals('SELECT table_name FROM information_schema.tables WHERE table_schema = \'' . self::TEST_DB_NAME . '\' AND table_type=\'BASE TABLE\'', $result); - } // testShowTables - - /** - * @covers ezSQL_postgresql::descTable - */ - public function testDescTable() { - $this->assertTrue($this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT)); - - $this->assertEquals(0, $this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))')); - - $this->assertEquals( - "SELECT ordinal_position, column_name, data_type, column_default, is_nullable, character_maximum_length, numeric_precision FROM information_schema.columns WHERE table_name = 'unit_test' AND table_schema='" . self::TEST_DB_NAME . "' ORDER BY ordinal_position", - $this->object->descTable('unit_test') - ); - - $this->assertEquals(0, $this->object->query('DROP TABLE unit_test')); - } // testDescTable - - /** - * @covers ezSQL_postgresql::showDatabases - */ - public function testShowDatabases() { - $this->assertTrue($this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT)); - - $this->assertEquals( - "SELECT datname FROM pg_database WHERE datname NOT IN ('template0', 'template1') ORDER BY 1", - $this->object->showDatabases() - ); - } // testShowDatabases - - /** - * @covers ezSQL_postgresql::query - */ - public function testQuery() { - $this->assertTrue($this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT)); - - $this->assertEquals(0, $this->object->query('CREATE TABLE unit_test(id integer, test_key varchar(50), PRIMARY KEY (ID))')); - - $this->assertEquals(0, $this->object->query('DROP TABLE unit_test')); - } // testQuery - - /** - * @covers ezSQL_postgresql::disconnect - */ - public function testDisconnect() { - $this->object->disconnect(); - - $this->assertFalse($this->object->isConnected()); - } // testDisconnect - - /** - * @covers ezSQL_postgresql::getDBHost - */ - public function testGetDBHost() { - $this->assertEquals(self::TEST_DB_HOST, $this->object->getDBHost()); - } // testGetDBHost - - /** - * @covers ezSQL_postgresql::getPort - */ - public function testGetPort() { - $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD, self::TEST_DB_NAME, self::TEST_DB_HOST, self::TEST_DB_PORT); - - $this->assertEquals(self::TEST_DB_PORT, $this->object->getPort()); - } // testGetPort - -} // ezSQL_postgresqlTest diff --git a/tests/shared/ezSQLcoreTest.php b/tests/shared/ezSQLcoreTest.php deleted file mode 100644 index fb56c19b..00000000 --- a/tests/shared/ezSQLcoreTest.php +++ /dev/null @@ -1,220 +0,0 @@ - - * @name ezSQLcoreTest - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - */ -class ezSQLcoreTest extends TestCase { - - /** - * @var ezSQLcore - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - $this->object = new ezSQLcore; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQLcore::register_error - */ - public function testRegister_error() { - $err_str = 'Test error string'; - - $this->object->register_error($err_str); - - $this->assertEquals($err_str, $this->object->last_error); - } // testRegister_error - - /** - * @covers ezSQLcore::show_errors - */ - public function testShow_errors() { - $this->object->hide_errors(); - - $this->assertFalse($this->object->getShowErrors()); - - $this->object->show_errors(); - - $this->assertTrue($this->object->getShowErrors()); - } // testShow_errors - - /** - * @covers ezSQLcore::hide_errors - */ - public function testHide_errors() { - $this->object->hide_errors(); - - $this->assertFalse($this->object->getShowErrors()); - } // testHide_errors - - /** - * @covers ezSQLcore::flush - */ - public function testFlush() { - $this->object->flush(); - - $this->assertNull($this->object->last_result); - $this->assertNull($this->object->col_info); - $this->assertNull($this->object->last_query); - $this->assertFalse($this->object->from_disk_cache); - } // testFlush - - /** - * @covers ezSQLcore::get_var - */ - public function testGet_var() { - $this->assertNull($this->object->get_var()); - } // testGet_var - - /** - * @covers ezSQLcore::get_row - */ - public function testGet_row() { - $this->assertNull($this->object->get_row()); - } // testGet_row - - /** - * @covers ezSQLcore::get_col - */ - public function testGet_col() { - $this->assertEmpty($this->object->get_col()); - } // testGet_col - - /** - * @covers ezSQLcore::get_results - */ - public function testGet_results() { - $this->assertNull($this->object->get_results()); - } // testGet_results - - /** - * @covers ezSQLcore::get_col_info - */ - public function testGet_col_info() { - $this->assertEmpty($this->object->get_col_info()); - } // testGet_col_info - - /** - * @covers ezSQLcore::store_cache - */ - public function testStore_cache() { - $sql = 'SELECT * FROM ez_test'; - - $this->object->store_cache($sql, true); - - $this->assertNull($this->object->get_cache($sql)); - } // testStore_cache - - /** - * @covers ezSQLcore::get_cache - */ - public function testGet_cache() { - $sql = 'SELECT * FROM ez_test'; - - $this->object->store_cache($sql, true); - - $this->assertNull($this->object->get_cache($sql)); - } // testGet_cache - - /** - * The test echos HTML, it is just a test, that is still running - * @covers ezSQLcore::vardump - */ - public function testVardump() { - $this->object->vardump(); - } // testVardump - - /** - * The test echos HTML, it is just a test, that is still running - * @covers ezSQLcore::dumpvar - */ - public function testDumpvar() { - $this->object->dumpvar(''); - } // testDumpvar - - /** - * @covers ezSQLcore::debug - */ - public function testDebug() { - $this->assertNotEmpty($this->object->debug(false)); - - // In addition of getting a result, it fills the console - $this->assertNotEmpty($this->object->debug(true)); - } // testDebug - - /** - * @covers ezSQLcore::donation - */ - public function testDonation() { - $this->assertNotEmpty($this->object->donation()); - } // testDonation - - /** - * @covers ezSQLcore::timer_get_cur - */ - public function testTimer_get_cur() { - list($usec, $sec) = explode(' ',microtime()); - - $expected = ((float)$usec + (float)$sec); - - $this->assertGreaterThanOrEqual($expected, $this->object->timer_get_cur()); - } // testTimer_get_cur - - /** - * @covers ezSQLcore::timer_start - */ - public function testTimer_start() { - $this->object->timer_start('test_timer'); - } // testTimer_start - - /** - * @covers ezSQLcore::timer_elapsed - */ - public function testTimer_elapsed() { - $expected = 0; - - $this->object->timer_start('test_timer'); - - $this->assertGreaterThanOrEqual($expected, $this->object->timer_elapsed('test_timer')); - } // testTimer_elapsed - - /** - * @covers ezSQLcore::timer_update_global - */ - public function testTimer_update_global() { - $this->object->timer_start('test_timer'); - $this->object->timer_update_global('test_timer'); - } - - /** - * @covers ezSQLcore::affectedRows - */ - public function testAffectedRows() { - $this->assertEquals(0, $this->object->affectedRows()); - } // testAffectedRows - -} // diff --git a/tests/sybase/ezSQL_sybaseTest.php b/tests/sybase/ezSQL_sybaseTest.php deleted file mode 100644 index 1a1c160a..00000000 --- a/tests/sybase/ezSQL_sybaseTest.php +++ /dev/null @@ -1,145 +0,0 @@ - - * @link http://twitter.com/justinvincent - * @name ezSQL_sybaseTest - * @package ezSQL - * @subpackage unitTests - * @license FREE / Donation (LGPL - You may do what you like with ezSQL - no exceptions.) - * @todo The connection to Sybase ASE is not tested by now. There might also - * be tests done for different versions of Sybase ASE - * - */ -class ezSQL_sybaseTest extends TestCase { - - /** - * @var ezSQL_sybase - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() { - if (!extension_loaded('ntwdblib')) { - $this->markTestSkipped( - 'The sybase extenstion is not available.' - ); - } - require_once 'sybase/ez_sql_sybase.php'; - $this->object = new ezSQL_sybase; - } // setUp - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() { - $this->object = null; - } // tearDown - - /** - * @covers ezSQL_sybase::quick_connect - * @todo Implement testQuick_connect(). - */ - public function testQuick_connect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuick_connect - - /** - * @covers ezSQL_sybase::connect - * @todo Implement testConnect(). - */ - public function testConnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testConnect - - /** - * @covers ezSQL_sybase::select - * @todo Implement testSelect(). - */ - public function testSelect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testSelect - - /** - * @covers ezSQL_sybase::escape - */ - public function testEscape() { - $result = $this->object->escape("This is'nt escaped."); - - $this->assertEquals("This is''nt escaped.", $result); - } // testEscape - - /** - * @covers ezSQL_sybase::sysdate - */ - public function testSysdate() { - $this->assertEquals('getDate()', $this->object->sysdate()); - } // testSysdate - - /** - * @covers ezSQL_sybase::query - * @todo Implement testQuery(). - */ - public function testQuery() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testQuery - - /** - * @covers ezSQL_sybase::ConvertMySqlTosybase - * @todo Implement testConvertMySqlTosybase(). - */ - public function testConvertMySqlTosybase() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testConvertMySqlTosybase - - /** - * @covers ezSQL_sybase::disconnect - * @todo Implement testDisconnect(). - */ - public function testDisconnect() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testDisconnect - - /** - * @covers ezSQL_sybase::getDBHost - * @todo Implement testGetDBHost(). - */ - public function testGetDBHost() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } // testGetDBHost - -} // ezSQL_sybaseTest \ No newline at end of file