Commit 48c67aba authored by romanb's avatar romanb

--no commit message

--no commit message
parent ade4cd2a
......@@ -16,7 +16,7 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
public function testFixture()
{
$forumUsers = $this->sharedFixture['connection']->query("FROM Forum_User u");
$forumUsers = $this->sharedFixture['connection']->query("FROM ForumUser u");
$this->assertEquals(2, count($forumUsers));
$forumUsers[0]->delete();
unset($forumUsers[0]);
......@@ -25,7 +25,7 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
public function testFixture2()
{
$forumUsers = $this->sharedFixture['connection']->query("FROM Forum_User u");
$forumUsers = $this->sharedFixture['connection']->query("FROM ForumUser u");
$this->assertEquals(2, count($forumUsers));
}
}
\ No newline at end of file
<?php
$fixture = array(
'model' => 'Forum_User',
'model' => 'ForumUser',
'rows' => array(
array(
'id' => 1,
......
......@@ -11,3 +11,22 @@ require_once 'Doctrine_DbalTestSuite.php';
require_once '../lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
$modelDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'models';
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
Doctrine::loadModels($modelDir);
/*
//spl_autoload_register(array('Doctrine_TestUtil', 'autoload'));
$modelDir = dirname(__FILE__)
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . 'models'
. DIRECTORY_SEPARATOR;
set_include_path(
get_include_path()
. PATH_SEPARATOR . $modelDir . 'cms'
. PATH_SEPARATOR . $modelDir . 'ecommerce'
. PATH_SEPARATOR . $modelDir . 'forum');
*/
\ No newline at end of file
......@@ -2,7 +2,6 @@
class Doctrine_TestUtil
{
public static function getConnection()
{
if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'],
......@@ -14,4 +13,12 @@ class Doctrine_TestUtil
}
}
public static function autoloadModel($className)
{
$modelDir = dirname(__CLASS__) . '/../models/';
$fileName = $modelDir . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
if (file_exists($fileName)) {
require $fileName;
}
}
}
\ No newline at end of file
<?php
class ForumAdministrator extends ForumUser
{
public static function initMetadata($class)
{
$class->addMappedColumn('foo', 'string', 50);
}
}
\ No newline at end of file
<?php
class Forum_User extends Doctrine_Record
class ForumUser extends Doctrine_Record
{
public static function initMetadata($class)
{
......@@ -8,10 +8,10 @@ class Forum_User extends Doctrine_Record
$class->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED, array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
1 => 'Forum_User',
2 => 'Forum_Administrator')
1 => 'ForumUser',
2 => 'ForumAdministrator')
));
$class->setSubclasses(array('Forum_Administrator'));
$class->setSubclasses(array('ForumAdministrator'));
// property mapping
$class->addMappedColumn('id', 'integer', 4, array(
......
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