[limb-svn] r6867 - in 3.x/trunk/limb/dbal/tests/cases: . toolkit
svn at limb-project.com
svn at limb-project.com
Sat Mar 29 09:54:12 MSK 2008
Author: svk
Date: 2008-03-29 09:54:12 +0300 (Sat, 29 Mar 2008)
New Revision: 6867
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6867
Added:
3.x/trunk/limb/dbal/tests/cases/.setup.php
Modified:
3.x/trunk/limb/dbal/tests/cases/toolkit/lmbDbToolsTest.class.php
Log:
-- adding automatic LIMB_VAR_DIR creation and definition during tests
-- saving connection during dbal tools testing
Added: 3.x/trunk/limb/dbal/tests/cases/.setup.php
===================================================================
--- 3.x/trunk/limb/dbal/tests/cases/.setup.php (rev 0)
+++ 3.x/trunk/limb/dbal/tests/cases/.setup.php 2008-03-29 06:54:12 UTC (rev 6867)
@@ -0,0 +1,7 @@
+<?php
+if(!defined('LIMB_VAR_DIR'))
+{
+ @define('LIMB_VAR_DIR', dirname(__FILE__) . '/../../../var');
+ if(!is_dir(LIMB_VAR_DIR) && !mkdir(LIMB_VAR_DIR))
+ throw new Exception("Could not create LIMB_VAR_DIR at '" . LIMB_VAR_DIR . "' during tests execution");
+}
Modified: 3.x/trunk/limb/dbal/tests/cases/toolkit/lmbDbToolsTest.class.php
===================================================================
--- 3.x/trunk/limb/dbal/tests/cases/toolkit/lmbDbToolsTest.class.php 2008-03-28 14:40:33 UTC (rev 6866)
+++ 3.x/trunk/limb/dbal/tests/cases/toolkit/lmbDbToolsTest.class.php 2008-03-29 06:54:12 UTC (rev 6867)
@@ -7,18 +7,25 @@
{
public $toolkit;
public $config;
+ protected $conn;
function setUp()
{
parent::setUp();
+ $this->toolkit = new lmbDbTools();
+ $this->conn = $this->toolkit->getDefaultDbConnection();
$this->config = array(
'dsn' => 'mysql://root:test@localhost/hello_from_foo?charset=cp1251',
'another_dsn' => 'sqlite://kraynopp:pasha@ksu/kadrs?charset=utf8'
);
lmbToolkit::instance()->setConf('db', new lmbSet($this->config));
-
- $this->toolkit = new lmbDbTools();
+ $this->toolkit->setDefaultDbConnection($this->toolkit->createDbConnection(new lmbDbDSN($this->config['dsn'])));
}
+
+ function tearDown()
+ {
+ $this->toolkit->setDefaultDbConnection($this->conn);
+ }
function testGetDbDSNByName()
{
@@ -58,5 +65,4 @@
$this->assertIdentical($another_connection, $this->toolkit->getDefaultDbConnection());
}
-}
-?>
+}
\ No newline at end of file
More information about the limb-svn
mailing list