From 518f26a2692126d4ae099ee7d88d74ad3b34b890 Mon Sep 17 00:00:00 2001 From: phishy Date: Fri, 16 May 2008 15:23:30 +0000 Subject: [PATCH] added test case for DboOracle and two regression tests git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6902 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../model/datasources/dbo/dbo_oracle.test.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php new file mode 100755 index 000000000..1891bbdca --- /dev/null +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php @@ -0,0 +1,60 @@ + + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.cake.libs + * @since CakePHP(tm) v 1.2.0 + * @version $Revision: 6296 $ + * @modifiedby $LastChangedBy: phpnut $ + * @lastmodified $Date: 2008-01-01 17:18:17 -0500 (Tue, 01 Jan 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ + +if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { + define('CAKEPHP_UNIT_TEST_EXECUTION', 1); +} +require_once LIBS.'model'.DS.'datasources'.DS.'dbo_source.php'; + +class DboOracleTest extends CakeTestCase { + + function setUp() { + $this->db = ConnectionManager::getDataSource('default'); + } + + function testLastErrorStatement() { + $this->expectError(); + $this->db->execute("SELECT ' FROM dual"); + $e = $this->db->lastError(); + $r = 'ORA-01756: quoted string not properly terminated'; + $this->assertEqual($e, $r); + } + + function testLastErrorConnect() { + $config = $this->db->config; + $this->db->config['password'] = 'keepmeout'; + $this->db->connect(); + $e = $this->db->lastError(); + $r = 'ORA-01017: invalid username/password; logon denied'; + $this->assertEqual($e, $r); + } + + +} + + +?> \ No newline at end of file