From 48c67aba2174ce8556b3ddf205a23e2e1f45334f Mon Sep 17 00:00:00 2001 From: romanb Date: Mon, 11 Feb 2008 19:56:26 +0000 Subject: [PATCH] --- tests/Orm/Component/TestTest.php | 4 ++-- tests/fixtures/forum/common/users.php | 2 +- tests/lib/DoctrineTestInit.php | 21 ++++++++++++++++++- tests/lib/Doctrine_TestUtil.php | 11 ++++++++-- tests/models/forum/ForumAdministrator.php | 9 ++++++++ .../forum/{Forum_User.php => ForumUser.php} | 8 +++---- 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 tests/models/forum/ForumAdministrator.php rename tests/models/forum/{Forum_User.php => ForumUser.php} (72%) diff --git a/tests/Orm/Component/TestTest.php b/tests/Orm/Component/TestTest.php index 60532ffe6..18c236d36 100644 --- a/tests/Orm/Component/TestTest.php +++ b/tests/Orm/Component/TestTest.php @@ -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 diff --git a/tests/fixtures/forum/common/users.php b/tests/fixtures/forum/common/users.php index e17a61dbf..6d071f401 100644 --- a/tests/fixtures/forum/common/users.php +++ b/tests/fixtures/forum/common/users.php @@ -1,6 +1,6 @@ 'Forum_User', + 'model' => 'ForumUser', 'rows' => array( array( 'id' => 1, diff --git a/tests/lib/DoctrineTestInit.php b/tests/lib/DoctrineTestInit.php index 93bc0bbf3..dc328f7d5 100644 --- a/tests/lib/DoctrineTestInit.php +++ b/tests/lib/DoctrineTestInit.php @@ -10,4 +10,23 @@ require_once 'Doctrine_OrmTestSuite.php'; require_once 'Doctrine_DbalTestSuite.php'; require_once '../lib/Doctrine.php'; -spl_autoload_register(array('Doctrine', 'autoload')); \ No newline at end of file +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 diff --git a/tests/lib/Doctrine_TestUtil.php b/tests/lib/Doctrine_TestUtil.php index e34e7176d..f5a80611c 100644 --- a/tests/lib/Doctrine_TestUtil.php +++ b/tests/lib/Doctrine_TestUtil.php @@ -1,8 +1,7 @@ addMappedColumn('foo', 'string', 50); + } +} \ No newline at end of file diff --git a/tests/models/forum/Forum_User.php b/tests/models/forum/ForumUser.php similarity index 72% rename from tests/models/forum/Forum_User.php rename to tests/models/forum/ForumUser.php index 4fc60ff59..e8e130eb4 100644 --- a/tests/models/forum/Forum_User.php +++ b/tests/models/forum/ForumUser.php @@ -1,6 +1,6 @@ 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(