Commit 373a0ac9 authored by romanb's avatar romanb

changes on the new test suite.

parent 36708c91
<?xml version="1.0" encoding="utf-8"?>
<!--
Use this configuration file as a template to run the tests against any dbms.
Procedure:
1) Save a copy of this file with a name of your chosing. It doesn't matter
where you place it as long as you know where it is.
i.e. "mysqlconf.xml" (It needs the ending .xml).
2) Edit the file and fill in your settings (database name, type, username, etc.)
Just change the "value"s, not the names of the var elements.
3) To run the tests against the database type the following from within the
tests/ folder: phpunit --configuration <filename> ...
Example: phpunit --configuration mysqlconf.xml AllTests
-->
<phpunit>
<php>
<var name="db_type" value="mysql"/>
<var name="db_host" value="localhost" />
<var name="db_username" value="foo" />
<var name="db_password" value="bar" />
<var name="db_name" value="doctrinetests" />
</php>
</phpunit>
\ No newline at end of file
......@@ -2,6 +2,7 @@
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'Doctrine_TestCase.php';
require_once 'Doctrine_TestUtil.php';
require_once 'Doctrine_DbalTestCase.php';
require_once 'Doctrine_OrmTestCase.php';
require_once 'Doctrine_TestSuite.php';
......
......@@ -18,8 +18,7 @@ class Doctrine_DbalTestCase extends Doctrine_TestCase
// to run tests that use a connection standalone.
// @todo Make DBMS choice configurable
if ( ! isset($this->sharedFixture['connection'])) {
$pdo = new PDO('sqlite::memory:');
$this->sharedFixture['connection'] = Doctrine_Manager::connection($pdo, 'sqlite_memory');
$this->sharedFixture['connection'] = Doctrine_TestUtil::getConnection();
}
}
}
\ No newline at end of file
......@@ -12,8 +12,7 @@ class Doctrine_DbalTestSuite extends Doctrine_TestSuite
protected function setUp()
{
// @todo Make DBMS choice configurable
$pdo = new PDO('sqlite::memory:');
$this->sharedFixture['connection'] = $this->loadConnection($pdo, 'sqlite_memory');
$this->sharedFixture['connection'] = Doctrine_TestUtil::getConnection();
}
protected function loadConnection($conn, $name)
......
......@@ -36,8 +36,7 @@ class Doctrine_OrmTestCase extends Doctrine_TestCase
// to run tests that use a connection standalone.
// @todo Make DBMS choice configurable
if ( ! isset($this->sharedFixture['connection'])) {
$pdo = new PDO('sqlite::memory:');
$this->sharedFixture['connection'] = Doctrine_Manager::connection($pdo, 'sqlite_memory');
$this->sharedFixture['connection'] = Doctrine_TestUtil::getConnection();
}
}
......
......@@ -11,8 +11,9 @@ class Doctrine_OrmTestSuite extends Doctrine_TestSuite
protected function setUp()
{
// @todo Make DBMS choice configurable
$pdo = new PDO('sqlite::memory:');
$this->sharedFixture['connection'] = $this->loadConnection($pdo, 'sqlite_memory');
//$pdo = new PDO('sqlite::memory:');
//$this->sharedFixture['connection'] = $this->loadConnection($pdo, 'sqlite_memory');
$this->sharedFixture['connection'] = Doctrine_TestUtil::getConnection();
}
protected function loadConnection($conn, $name)
......
<?php
class Doctrine_TestUtil
{
public static function getConnection()
{
if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'],
$GLOBALS['db_host'], $GLOBALS['db_name'])) {
$dsn = "{$GLOBALS['db_type']}://{$GLOBALS['db_username']}:{$GLOBALS['db_password']}@{$GLOBALS['db_host']}/{$GLOBALS['db_name']}";
return Doctrine_Manager::connection($dsn, 'testconn');
} else {
return Doctrine_Manager::connection(new PDO('sqlite::memory:'), 'testconn');
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment