From bc6a8e03b5de481044b8e0b6b0384986921253f3 Mon Sep 17 00:00:00 2001 From: gwoo Date: Sat, 17 May 2008 13:59:29 +0000 Subject: [PATCH] fixes #4671, skip DboOracle tests when driver is not set. Clean up other dbo tests to be consistent git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6908 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../libs/model/datasources/dbo/dbo_mssql.test.php | 3 +-- .../libs/model/datasources/dbo/dbo_mysql.test.php | 3 +-- .../libs/model/datasources/dbo/dbo_oracle.test.php | 13 +++++++------ .../model/datasources/dbo/dbo_postgres.test.php | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php index e53a3dd2d..e5da0c890 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php @@ -117,8 +117,7 @@ class DboMssqlTest extends CakeTestCase { */ function skip() { $this->_initDb(); - $db =& ConnectionManager::getDataSource('test_suite'); - $this->skipif ($db->config['driver'] != 'mssql', 'SQL Server connection not available'); + $this->skipif ($this->db->config['driver'] != 'mssql', 'SQL Server connection not available'); } /** * Sets up a Dbo class instance for testing diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index f558e4f21..f515feacd 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -120,8 +120,7 @@ class DboMysqlTest extends CakeTestCase { */ function skip() { $this->_initDb(); - $db =& ConnectionManager::getDataSource('test_suite'); - $this->skipif($db->config['driver'] != 'mysql', 'MySQL connection not available'); + $this->skipif($this->db->config['driver'] != 'mysql', 'MySQL connection not available'); } /** * Sets up a Dbo class instance for testing 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 index 1891bbdca..cf51c5e01 100755 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php @@ -31,11 +31,12 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { require_once LIBS.'model'.DS.'datasources'.DS.'dbo_source.php'; class DboOracleTest extends CakeTestCase { - - function setUp() { - $this->db = ConnectionManager::getDataSource('default'); + + function skip() { + $this->_initDb(); + $this->skipif($this->db->config['driver'] != 'oracle', 'Oracle connection not available'); } - + function testLastErrorStatement() { $this->expectError(); $this->db->execute("SELECT ' FROM dual"); @@ -43,7 +44,7 @@ class DboOracleTest extends CakeTestCase { $r = 'ORA-01756: quoted string not properly terminated'; $this->assertEqual($e, $r); } - + function testLastErrorConnect() { $config = $this->db->config; $this->db->config['password'] = 'keepmeout'; @@ -53,7 +54,7 @@ class DboOracleTest extends CakeTestCase { $this->assertEqual($e, $r); } - + } diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php index 72431a1de..2bf7ab378 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php @@ -115,7 +115,6 @@ class DboPostgresTest extends CakeTestCase { */ function skip() { $this->_initDb(); - $db = ConnectionManager::getDataSource('test_suite'); $this->skipif ($this->db->config['driver'] != 'postgres', 'PostgreSQL connection not available'); }