3 -----------------------*/
4 define ('DB_TYPE', 'mysql');
5 define ('DB_HOST', 'localhost');
6 define ('DB_USER', 'root');
7 define ('DB_PASS', 'ASD');
8 define ('DB_NAME', 'b');
10 usingPackage ('models/foo');
11 usingPackage ('models/sqldrivers');
12 usingPackage ('coreexceptions');
14 include_once ('fixtures/dummytable.class.php'); // the definition of the entity
15 include_once ('fixtures/dataobject.class.php'); // the definition of the data object
17 class fooTdoTest
extends UnitTestCase
{
20 public function setUp () {
21 $this->connection
= new fooTdo();
22 $this->connection
->getConnection()->selectDatabase('test');
25 public function tearDown() {}
27 public function test_Instantiation () {
28 $this->assertIsA($this->connection
, 'fooTdo');
29 $this->assertIsA($this->connection
, 'fooTdoA');
32 public function testGetConnection () {
33 $this->connection
->setConnection (sqlFactory
::connect('mysql'));
34 $this->assertIsA($this->connection
->getConnection(), 'mySqlIm');
37 public function testCreateSQL () {
38 // we should have a separate test for each type of connection
39 // the test should be the actual creation
40 $o = new dummyTable();
41 $createSQL = $this->connection
->outputCreateSQL($o);
43 $i = $this->connection
->getConnection()->query($createSQL);
44 $this->assertTrue($i, 'Creation of table failed');
46 $this->connection
->getConnection()->query('DROP TABLE ' . $o->getName());
47 } catch (Exception
$e) {
48 // the drop of the table might go wrong - why oh why ?